npm install fails to exec postinstall script bower install - npm

I snooped around the net for more than 48 hours & failed to solve this.
When I run the command 'npm install', it fails to execute the postinstall script 'bower install'. So, I I did an explicit bower install by using:
$npm install -g bower
$bower install
After this, the 'app/bower_components' folder got populated alright. But, again when I try 'npm install', same issue. Unable to proceed further.
I performed the following & did not succeed in installing:
Git is installed & its path added in the PATH environment variable. And then run 'npm install'. Even restarted the command prompt in order for the PATH variable to reflect.
Run 'npm install restify', though I don't know why the installation has to be made a REST service.
I used this, as it was one of the suggestions I came across.
In some post, it was mentioned that it could be due to firewall settings. Disabled the same & tried as well.
Changed all the files under my project 'angular-phonecat' to have read-write permissions. Did this by unchecking 'Read-only' option for the entire folder's contents.
Run Git Bash as admin & tried 'npm install'.
Please help me run this app. :(
Find below my logs:
600 info install angular-phonecat#0.0.0
601 info postinstall angular-phonecat#0.0.0
602 verbose unsafe-perm in lifecycle true
603 info angular-phonecat#0.0.0 Failed to exec postinstall script
604 error angular-phonecat#0.0.0 postinstall: `bower install`
604 error spawn ENOENT
605 error Failed at the angular-phonecat#0.0.0 postinstall script.
605 error This is most likely a problem with the angular-phonecat package,
605 error not with npm itself.
605 error Tell the author that this fails on your system:
605 error bower install
605 error You can get their info via:
605 error npm owner ls angular-phonecat
605 error There is likely additional logging output above.
606 error System Windows_NT 6.2.9200
607 error command "g:\\Workspace\\AngularProjects\\angular-phonecat\\node.exe" "g:\\Workspace\\AngularProjects\\angular-phonecat\\node_modules\\npm\\bin\\npm-cli.js" "install"
608 error cwd g:\Workspace\AngularProjects\angular-phonecat
609 error node -v v0.10.32
610 error npm -v 1.4.28
611 error syscall spawn
612 error code ELIFECYCLE
613 error errno ENOENT
614 verbose exit [ 1, true ]

You will need to provide more information in order to get an answer to this question. It looks like angular-phonecat is your own module that you created -- can you please publish its package.json as a gist https://gist.github.com and attach the link here?
Also, your npm is rather old (and was even at the time you asked this question). I would recommend updating to the latest version of npm, which at this writing is 2.2.0.
To update npm on Windows, follow the instructions here: https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows
Thanks!

try npm-check module to test if any component is outdated

Related

Why is npx not finding the package.json in the parent directory?

The Goal: 'npx elm make' running successfully in a GitLab CD
Background: I have a bit of a toy frontend project on GitLab pages, and I've written a crude CI/CD pipeline for it. This includes building a subdirectory with elm files. It worked for a while and then suddenly broke, and I can't seem to fix it.
The script is as follows:
cd public/scripts/
npm i
cd elm/
npx elm make src/Main.elm --output=index.js
and then continues with the rest of the script.
These instructions work fine on my machine.
The issue: 'npx elm make' looks for a package.json in the elm directory.
Here is the output from the failed build:
Running with gitlab-runner 13.5.0-rc2 (71c90c86)
on docker-auto-scale z3WU8uu-
Resolving secrets
00:00
Preparing the "docker+machine" executor
Using Docker executor with image node:latest ...
Pulling docker image node:latest ...
Using docker image sha256:ca36fba5ad66b0f8fce2b97a6f0aa53267395388ada988534d848638312ccb68 for node:latest with digest node#sha256:bf60a164bc588967ce6e3342c9d6508bf9ad2e7e2a1c237315596eab3e13428b ...
Preparing environment
00:03
Running on runner-z3wu8uu--project-21153296-concurrent-0 via runner-z3wu8uu--srm-1603581774-6b7f1e48...
Getting source from Git repository
00:23
$ eval "$CI_PRE_CLONE_SCRIPT"
Fetching changes with git depth set to 50...
Initialized empty Git repository in /builds/chicagotestout/chicagotestout.gitlab.io/.git/
Created fresh repository.
Checking out b73b89bb as master...
Skipping Git submodules setup
Executing "step_script" stage of the job script
00:01
$ cd public/scripts/
$ npm i
up to date, audited 49 packages in 644ms
found 0 vulnerabilities
$ cd elm/
$ npx elm make src/Main.elm --output=index.js
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /builds/chicagotestout/chicagotestout.gitlab.io/public/scripts/elm/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/builds/chicagotestout/chicagotestout.gitlab.io/public/scripts/elm/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-10-24T23_24_44_668Z-debug.log
Cleaning up file based variables
00:01
ERROR: Job failed: exit code 1
So it's looking for a package.json file in the elm subdirectory. Okay. But I don't have (and don't need, and don't want) a package.json file there. The relevant package.json file is in its parent directory (scripts) where elm is installed.
Confounding factors
You might be wondering what was in the commit that broke the build when it quit working, but there's nothing in that commit that should have broken the build in this way. The commit didn't touch any configuration files, just some .elm source files.
My gut says this is an npm thing, but I can't quite rule out the idea that this is an elm thing or a gitlab-ci thing.
I've searched for this issue, but it seems like this is a pretty uncommon issue, and I'm struggling to filter out a heap of other package.json search terms.
In Conclusion
How do I get npx to look in the parent directory for the appropriate package.json?
Help appreciated.

How to fix "Error: Watching remote files is not supported" problem in Visual Studio Code

I have Vue application that I don't run for a while and now I cannot start development server?! In meanwhile something updated and that don't work. I tried new clean vue/vuetify install and same problem!
Build for production works normally, only run development server don't work.
And important notice: when run "npm run serve" in command prompt (outside VS Code), it works normally. That not work only in VS Code Terminal. What is problem?
Node version is v10.16.0
Npm version is 6.10.3
VS Code About:
Commit: 036a6b1d3ac84e5ca96a17a44e63a87971f8fcc8
Date: 2019-08-08T02:33:50.993Z
Electron: 4.2.7
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 10.0.17763
Error (from terminal window):
> Executing task: npm run serve <
> portal#0.1.0 serve d:\Wamp64\www\portal
> vue-cli-service serve
INFO Starting development server...
10% building 2/2 modules 0 active ERROR Error: Watching remote files is not supported.
Error: Watching remote files is not supported.
at Server.setupWatchStaticFeature (d:\Wamp64\www\portal\node_modules\webpack-dev-server\lib\Server.js:405:13)
at Object.watchContentBase (d:\Wamp64\www\portal\node_modules\webpack-dev-server\lib\Server.js:477:14)
at forEach (d:\Wamp64\www\portal\node_modules\webpack-dev-server\lib\Server.js:550:24)
at Array.forEach (<anonymous>)
at Server.setupFeatures (d:\Wamp64\www\portal\node_modules\webpack-dev-server\lib\Server.js:549:49)
at new Server (d:\Wamp64\www\portal\node_modules\webpack-dev-server\lib\Server.js:125:10)
at serve (d:\Wamp64\www\portal\node_modules\#vue\cli-service\lib\commands\serve.js:139:20)
at process._tickCallback (internal/process/next_tick.js:68:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:832:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! portal#0.1.0 serve: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the portal#0.1.0 serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Sasa Gosovic\AppData\Roaming\npm-cache\_logs\2019-08-11T10_35_40_418Z-debug.log
The terminal process terminated with exit code: 1
Press any key to close the terminal.
Exactly the same issue here. I resolved it by rolling back the version of webpack-dev-server.
npm install webpack-dev-server#3.7.2 --save-dev
Looks like the setupWatchStaticFeature function has changed between 3.7.2 and 3.8.0 which is triggering the issue.
You can eddit the vue.config.js file, adding following code:
devServer: {
contentBase: './public'
}
More details: https://github.com/webpack/webpack-dev-server/issues/2190#issuecomment-520670599
Until the issue is open, a workaround could be to use Git Bash instead of Windows command line to run npm run serve. I modified Server.js to output the contentBase variable. When using Windows command line or Vue UI, the variable contained "c:\...". Using Git Bash on my Windows 10 machine it contains "C:\..." and it worked.

Failed to install react-native-navigation module. Thrown error "ENOENT: no such file or directory"

I tried installing react-native-navigation (by wix) package quite a few times using npm. The process was initiated, but for some reason it was not getting completed. I cancelled it in first attempt, and proceeded with installation again. For some reason npm was unable to install the package and started exiting with following error:
679 error enoent ENOENT: no such file or directory, rename 'D:\Workspace\pokemonn\node_modules\hoist-non-react-statics' -> 'D:\Workspace\pokemonn\node_modules\.hoist-non-react-statics.DELETE'
680 error enoent This is related to npm not being able to find a file.
681 verbose exit [ -4058, true ]
I'm on Window machine, with node 10.x LTS & npm 6.x & react-native 0.57.8 installed.
This issue got resolved much earlier, I forgot to update here.
There was a thread open on github which I found later related to npm installation. After following the steps mentioned, I was able to install it.
Following are the steps:
Delete both node_modules directory, and package-lock.json file from project folder
type npm cache clean --force and hit Enter
type npm install -g react-native-navigation and hit Enter
[More: Github article]

npm install fails: buble#github:pemrouz/buble reference is not a tree

Summary:
I am looking for a strategy on how I might find and fix an error in package-lock.json. This error breaks npm install:
How do I figure out what installed this buble dependency?
Can I simply delete the entry?
How do I figure out what the reference value should be?
Details
I wanted to update my node_modules. So I deleted my node_modules directory, and ran npm install. While this has always worked in the past, it is now failing with the following error (found in the AppData\Roaming\npm-cache_logs\XXXX-debug.log):
13 silly fetchPackageMetaData error for buble#github:pemrouz/buble#fdcd2bac2c8945816b6fe3b032e49b58cc728b14 Command failed: C:\Program Files\Git\mingw64\bin\git.EXE checkout fdcd2bac2c8945816b6fe3b032e49b58cc728b14
13 silly fetchPackageMetaData fatal: reference is not a tree: fdcd2bac2c8945816b6fe3b032e49b58cc728b14
14 verbose stack Error: Command failed: C:\Program Files\Git\mingw64\bin\git.EXE checkout fdcd2bac2c8945816b6fe3b032e49b58cc728b14
14 verbose stack fatal: reference is not a tree: fdcd2bac2c8945816b6fe3b032e49b58cc728b14
14 verbose stack
14 verbose stack at ChildProcess.exithandler (child_process.js:271:12)
14 verbose stack at emitTwo (events.js:125:13)
14 verbose stack at ChildProcess.emit (events.js:213:7)
14 verbose stack at maybeClose (internal/child_process.js:927:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
I believe the reference is from /package-lock.json where I find 2 entries using this reference. Searching the Net has taught me that /package-lock.json is updated by npm. I do not know how this bubble package got added to my project - must be a dependency of some other package, but I lack the skills to figure out which. The entries look like the following:
...
"buble": {
"version": "github:pemrouz/buble#fdcd2bac2c8945816b6fe3b032e49b58cc728b14",
"requires": {
"acorn": "5.2.1",
...
Searching the Net for similar issues seem to be from users who are trying to sync up their repositories. Those solutions suggest ways to sync forks in Gitub which does not apply to my case. Near as I can tell, someone has updated the Github repository in some way which breaks this reference.
So, I am looking for a strategy on how I might fix this. How do I figure out what installed this buble dependency? Can I simply delete the entry? How do I figure out what the reference value should be?
Thanks in advance for any direction
I got this working. What I did was delete all references to buble in my package-lock.json file (after having made a back-up copy of course). I then deleted my node_modules directory, did npm cache clear --force, then npm install. npm was able to reload everything, and seems to have re-added the buble package to my package-lock.json now with a new reference value.
I do not know if all these steps were necessary; in the end I was getting desperate and ready to try everything. Hope this helps someone else!
I believe you can run npm install --no-optional buble which should prevent optional dependencies from being installed. Before you do this you should delete the old node_modules and start fresh.
https://docs.npmjs.com/cli/install
My problem was that I did not GIT github installed on my machine. You need to install Git, so the npm install can use it to download packages
I have similar problem but not quite same. I had this issue when I try to npm install inside my company network environment. Some certain SSH and HTTPS is blocked. The error message is
npm sill pacote Retrying git command: ls-remote -h -t https://github.com/pemrouz/buble.git attempt # 6
npm sill pacote Retrying git command: ls-remote -h -t https://github.com/pemrouz/buble.git attempt # 7
I removed package-lock.json and do npm install again. Everything was fine.
delete package-lock.json and do npm install again

npm install error - cb() never called

I try to install node_module in my angular project what I downloaded, but I get this error:
npm ERR! registry error parsing json
Then i reinstall npm using npm intall npm -g and after when i try use npm install I get this error:
(node:11252) UnhandledPromiseRejectionWarning: Unhandled promise
rejection (rejection id: 1): Error: ENOENT: no such file or directory, stat
'C:\Users\User\AppData\Roaming\npm-cache\_cacache\tmp\git-clone-ec5da46c\angular\cdk.es5.js'
debug.log:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install' ]
2 info using npm#5.4.2
3 info using node#v6.10.2
4 verbose npm-session ff5ce249dfe37f0e
5 silly install runPreinstallTopLevelLifecycles
6 silly preinstall spa#0.0.0
7 info lifecycle spa#0.0.0~preinstall: spa#0.0.0
8 silly install loadCurrentTree
9 silly install readLocalPackageData
10 silly install loadIdealTree
11 silly install cloneCurrentTreeToIdealTree
12 silly install loadShrinkwrap
13 info lifecycle #angular/cdk#2.0.0-beta.10-a7ce31e~prepack: #angular/cdk#2.0.0-beta.10-a7ce31e
14 error cb() never called!
15 error This is an error with npm itself. Please report this error at:
16 error <https://github.com/npm/npm/issues>
I already tried npm cache clean --force but i get same error.
node -v v6.10.2
npm -v 5.4.2
I had the same issue. I resolved it
by excluding package-lock.json file
npm i --no-package-lock
OR by manually deleting package-lock.json
Run npm cache clean --force and perform an install.
I had the same issue. I resolved it by remove nodejs#10 and install nodejs#8
On Windows 10 running npm install gave me this error.
I solved this issue by doing so from within Administrator: Command Prompt.
Ensure that you have a package.json file within the root of your angular project which should look something similar to this.
https://github.com/heroku/node-js-sample/blob/master/package.json
If the package.json file exists, you run npm install to get the packages saved to it and that will generate a node_modules directory for you.
However, if the file does not exist, it means you have to initialize npm into the project by running npm i -y which should automatically create a package.json file for you and as well allow you to install node modules.
NB: You have npm installed on your machine already so running npm install npm -g is not ideal.
I got this error when my package.json referred to a package using file:../(local path) and the directory didn't exist. Pointing it to the correct path resolved the error.
In my case... none of the above worked. I then deleted my package-lock.json. When I ran an npm install I got an error that a certain package could not be found in the repository. When I removed that from package.json my npm install worked!
I had the same issue. In my case it was caused by a syntax error within the .npmrc file, which was manually edited
Method 1:
npm cache clean --force then install your package
Method 2:
Disable your antivirus software and try to install your package
Method 3:
It is your internet connection, if you are using Wifi or an Ethernet connection use your cellular network or a different network and try to install your package