NPM Install Error - Node-Pre-Gyp - node.js

When I try to run npm-install I get:
npm ERR! Windows_NT 6.3.9600 npm ERR! argv "C:\Program Files
(x86)\nodejs\node.exe" "C:\Program Files (x8
6)\nodejs\node_modules\npm\bin\npm-cli.js" "install" npm ERR!
node v4.0.0 npm ERR! npm v2.14.2 npm ERR! code ELIFECYCLE
npm ERR! v8-debug#0.4.6 install: node-pre-gyp install
--fallback-to-build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the v8-debug#0.4.6 install script 'node-pre-gyp install --fal
lback-to-build'. npm ERR! This is most likely a problem with the
v8-debug package, npm ERR! not with npm itself. npm ERR! Tell the
author that this fails on your system: npm ERR! node-pre-gyp
install --fallback-to-build npm ERR! You can get their info via: npm
ERR! npm owner ls v8-debug npm ERR! There is likely additional
logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:_Src\Personal\rzaleski\ILikeThis\npm-debug.log
I tried a number of things (installing VS C++ redistrib, npm install --msvs_version=2013, etc). Nothing seems to work.
Do you have any ideas how I can find out the actual error (the log is a bit daunting).
UPDATE: What I ended up doing was reverting from Node v4.0.0 to NODE v0.12. This is not really a fix to the issue, but it got me around my issues.

Go to: (http://www.devdocs.io) look # the npm section. Must use desktop, must use windows if possible (Mac layout is weird for some reason) Follow the steps detailed for "resetting npm cache"
Node-gyp is a P.I.T.A. and often blows up installs among other things. I have a horrible time with it every time I come back to an environment I haven't used in a while and try to use it again.
Alternatively, you can uninstall node, and attempt to reinstall using chocolatey if you're on windows or brew if you're on a mac. Make sure you sudo commands when installing to mac.
You're most likely going to have to clean out the npm cache, possibly reinstall nodejs, and possibly reinstall node-gyp.
NOTE: Before you go about the above mentioned steps, first make sure that your configurations are compatible, including your python version for node-gyp. (https://www.npmjs.com/package/node-gyp) Also, I have solved the C++ redistributable issues several times without touching anything C++ related, just so you know this error is not indicative of C++, but rather local settings and compatible software versions that interact with node + npm NOT C++ related (for instance, your python version interacting with node-gyp)
There is no straightforward "run this and that" to fix, you kind of have to muddle through it, and I can promise you that you'll have to do it more than once. But the more you fix node + npm + node-gyp, the more able you will be to quickly remedy all issues in the future. The links above should sort you out no problem though. Just walk through them slowly and thoroughly as instructed.

All i did is uninstall node and install it again, and during the installation, check the box telling you to install the needed dependencies and complete your installation.
If it persists, locate the package that is causing this error and install it seperately.
Example:
npm install -g node-gyp
npm install bcrypt

Related

node-gyp rebuild fails on Mac OS High Sierra while npm install

I am getting following error in the terminal, while it tries to install one of package "node-expat". I have tried switching to different node version using nvm but still it is failing with same error.
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/node-expat
npm ERR! node v6.5.0
npm ERR! npm v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! node-expat#2.0.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-expat#2.0.0 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the node-expat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs node-expat
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls node-expat
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! c:\<redacted>\npm-debug.log
I went ahead installing x-code as suggested on git hub page, on my machine and then it is giving following error,. Not sure how to debug further.
xcode-select: error: tool 'xcodebuild' requires Xcode,
but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
I just got it fixed on my machine and my fellow colleagues machine.
Followed the following steps to fix it on MacOS highSierra 10.13:
Downloaded command line tools (MacOS 10.13) for xcode and installed it.
Download it from "https://developer.apple.com/download/more/"
Installed xcode 10.0 from the app store. Opened xcode and went through the regular configuration xcode does in the initial start up.
After this it started giving "xcode-select" path issue as stated in the description above. On running command "xcode-select --print-path" it was showing path as '/ Library/Developer/CommandLineTools', so i went ahead and tried "xcode-select --reset" after which the path changed to "/Applications/Xcode.app/Contents/Developer".
Immediately after it the build started working without any issues.
Solution above mentioned by Luke worked partially for me (MacOS) but created another issue :
gyp ERR! stack Error:makefailed with exit code: 2 which was solved by removing locked json file. Issue was created due to permission in MAC OS. So if you have xcode re-installed already, open terminal (command line) and type:
xcode-select --reset
then go to your project folder and remove:
package-lock.json
Now in terminal reinstall project :
npm install
I hope this helps someone!

Error Installing laravel-elixir on windows: npm ERR! EEXIST, open '\AppData\Roaming\npm-cache\837c67b9-adable-s tream-1-0-33-package-tgz.lock'

I have a fresh installation of laravel 5.1. I followed these steps to Set up Elixir, Bootstrap, Font-awesome etc. When I run npm install it throws an error. I also tried using npm install --no-bin-links as the laravel elixir documentation suggests.
$ npm install --no-bin-links
npm WARN optional dep failed, continuing fsevents#0.3.8
npm WARN optional dep failed, continuing fsevents#0.3.8
> node-sass#3.2.0 install c:\Users\user\PhpstormProjects\my_project\node_modules\laravel-elixir\node_modules\gulp-sass\node_modules\node-sass
> node scripts/install.js
Binary downloaded and installed at c:\Users\user\PhpstormProjects\my_project\node_modules\laravel-elixir\node_modules\gulp-sass\node_modules\node-sass\vendor\win32-x64-11\binding.node
> node-sass#3.2.0 postinstall c:\Users\user\PhpstormProjects\my_project\node_modules\laravel-elixir\node_modules\gulp-sass\node_modules\node-sass
> node scripts/build.js
` c:\Users\user\PhpstormProjects\my_project\node_modules\laravel-elixir\node_modules\gulp-sass\node_modules\node-sass\vendor\win32-x64-11\binding.node ` exists.
testing binary.
Binary is fine; exiting.
npm ERR! EEXIST, open 'C:\Users\user\AppData\Roaming\npm-cache\837c67b9-adable-stream-1-0-33-package-tgz.lock'
File exists: C:\Users\user\AppData\Roaming\npm-cache\837c67b9-adable-stream-1-0-33-package-tgz.lock
Move it away, and try again.
npm ERR! System Windows_NT 6.1.7600
npm ERR! command "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--no-bin-links"
npm ERR! cwd c:\Users\user\PhpstormProjects\my_project
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! path C:\Users\user\AppData\Roaming\npm-cache\837c67b9-adable-stream-1-0-33-package-tgz.lock
npm ERR! code EEXIST
npm ERR! errno 47
npm ERR! not ok code 0
I searched for the file (that exists) in the npm-cache directory and found there are no such file. But, when I execute the npm command it is created along with hundreds of LOCK file. I tried to delete the file during the installation process (which is quite tricky and seems impossible, because there are a lot of files created and removed simultaneously), which didn't help much. The error is not always the same. Most of the time it says 837c67b9-adable-stream-1-0-
33-package-tgz.lock file exists, some times it's just some other LOCK file.
I also tried updating npm to the latest release: npm -g install npm#latest (sauce)
What helped me on Win 8.1:
Install newest version of Python (3.5 at the moment) and make sure it's on your path (open some command line tool like power shell and enter 'py --version').
npm cache clear
In the laravel installation folder run: npm install --no-bin-links
I was also running power shell as an administrator when issuing the commands, but I'm not sure it matters (won't hurt in this case though).
I faced the same problem and run the terminal as administrator and it solved the problem.
I am not sure about you but issue but now the gulp is working :)

‘node-gyp rebuild’ installation error when adding a package to meteor app in Windows 7

I was trying to add a package (mizzao:turkserver) to my Meteor application, but I kept getting this error:
mizzao:turkserver: updating npm dependencies -- request, libxmljs,
validator, querystring, async, deepmerge...
gypnpm ERR! Windows_NT 6.1.7601
npm ERR! argv
"C:\\Users\\PC4all\\AppData\\Local\\.meteor\\packages\\meteor-tool\\1.1.3\\mt-os
.windows.x86_32\\dev_bundle\\bin\\\\node.exe"
"C:\\Users\\PC4all\\AppData\\Local\\.meteor\\packages\\meteor-tool\\1.1.3\\mt-os
.windows.x86_32\\dev_bundle\\bin\\node_modules\\npm\\bin\\npm-cli.js"
"install" "libxmljs#0.8.1"
npm ERR! node v0.10.36
npm ERR! npm v2.7.3
npm ERR! code ELIFECYCLE
npm ERR! libxmljs#0.8.1 install: `node-gyp rebuild`
npm ERR! Exit status 7
npm ERR!
npm ERR! Failed at the libxmljs#0.8.1 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the libxmljs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls libxmljs
npm ERR! There is likely additional logging output above.
=> Babel active on file extensions: es6.js, es6, jsx
=> Errors while adding packages:
While building package mizzao:turkserver:
error: couldn't install npm package
I am developing my Meteor application on a Windows 7 machine and from what I have been able to gather from posts on forums, the error seems to be related to that fact (interaction between npm and Windows - I did not find any posts describing the same problem on Linux machines).
I've already tried installing the latest Python version and MS Visual Studio 2013 as suggested here: https://github.com/TooTallNate/node-gyp#installation, as well as setting some environment variables as suggested here: https://github.com/atom/atom/issues/2754. But none of those helped.
Any help would be greatly appreciated!
As I described in this comment, this seems to be an issue with the Python path being set incorrectly for npm, as Meteor's distribution of npm isn't hooking it up correctly. Most Linux distros come with Python, but Windows doesn't, so it is correlated with running Windows.
It can be fixed by making sure that Python is installed, then running the following command:
npm config set python C:\Python27\python.exe
The use of an old libxmljs is because mizzao:turkserver is dependent on a relatively old node MTurk API, which I'd like to wean it off of at some point, but isn't such a high priority at the moment.
See also:
https://github.com/lovell/sharp/issues/163
https://www.robertkehoe.com/2015/03/fix-node-gyp-rebuild-error-on-windows/

NodeJS "npm update -g npm" fails with "Error: Refusing to delete" (Installed via package, NOT homebrew)

While trying to fix a JPG compatibility issue, I'm running into the following error when trying to update npm on my Mac OSX (Yosemite). Note that I did not install via homebrew, instead via the official package. (I'm using version 0.10.37 to counteract yet another NPM package issue).
Here are the steps I take:
brew uninstall node and brew uninstall npm to be triple-sure Node is not present on my system via Homebrew. The output is as expected, Error: No such keg: /usr/local/Cellar/node
Download the package from http://nodejs.org/dist/v0.10.37/ and install it.
node -v to verify that Node is installed.
npm update -g npm
And here's the output from that last command:
$ npm update -g npm
npm ERR! Refusing to delete: /usr/local/share/man/man3/npm-bin.3 not in /usr/local/lib/node_modules/npm
File exists: /usr/local/share/man/man3/npm-bin.3
Move it away, and try again.
npm ERR! System Darwin 14.1.0
npm ERR! command "node" "/usr/local/bin/npm" "update" "-g" "npm"
npm ERR! cwd /Users/topher
npm ERR! node -v v0.10.37
npm ERR! npm -v 1.4.28
npm ERR! path /usr/local/share/man/man3/npm-bin.3
npm ERR! code EEXIST
npm ERR! error rolling back Error: Refusing to delete: /usr/local/share/man/man3/npm-bin.3 not in /usr/local/lib/node_modules/npm
npm ERR! error rolling back at clobberFail (/usr/local/lib/node_modules/npm/lib/utils/gently-rm.js:57:12)
npm ERR! error rolling back at next (/usr/local/lib/node_modules/npm/lib/utils/gently-rm.js:43:14)
npm ERR! error rolling back at /usr/local/lib/node_modules/npm/lib/utils/gently-rm.js:52:12
npm ERR! error rolling back at Object.oncomplete (evalmachine.<anonymous>:108:15)
npm ERR! error rolling back { [Error: Refusing to delete: /usr/local/share/man/man3/npm-bin.3 not in /usr/local/lib/node_modules/npm] code: 'EEXIST', path: '/usr/local/share/man/man3/npm-bin.3' }
npm ERR! not ok code 0
When I delete the above mentioned file and try again, I get another error because the npm command no longer exists. It looks like the update partially succeeded in that the npm command was deleted:
$ npm
-bash: /usr/local/bin/npm: No such file or directory
When I search for this "Refusing to delete" error, I see tons of advice for how to fix a botched Homebrew install (plus some unnecessarily condescending instructions on how to remove the Homebrew package. But I'm not installing the package via homebrew; the advice I'm finding there doesn't seem relevant in my case.
How should I go about troubleshooting this? Anyone else know of / have this problem / can think of a quick fix?
Thanks in advance!
This isn't a complete answer, but just to follow up I found a way to work around this issue.
My ultimate need was to get node running with the package resemble installed. Resemble relies on cairo, which was installed via homebrew; it seems that this was my first mistake. Because Cairo was apparently improperly installed, a couple packages were missing; this forced me to use one workaround that triggered other errors and required other workarounds... and so forth.
When I removed the Cairo homebrew package and instead built Cairo from source (using this guide), several other errors I was having just melted away.
So the lesson I'm learning is: Don't use Homebrew for anything finnicky, or for any dependencies of anything finnicky.
I solve it by this:
rm /usr/bin/npm
/usr/lib64/node_modules/npm/bin/npm-cli.js install npm -g
npm -v # success !

npm Error Installing - npm ERR! cb() never called not ok code 0

Windows 7 (64)
npm version 1.3.24
node version 0.10.25
When I am trying to install bower I am getting this error message
C:\>npm install bower -g
npm http GET https://registry.npmjs.org/bower
npm ERR! cb() never called!
npm ERR! not ok code 0
I already tried
npm cache clean
and
npm install - getting another error message
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\andpon>cd/
C:\>npm install
npm ERR! install Couldn't read dependencies
npm ERR! package.json ENOENT, open 'C:\package.json'
npm ERR! package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can't find a package.json file in your current directo
ry.
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! cwd C:\
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! path C:\package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\npm-debug.log
npm ERR! not ok code 0
Can any one know solution for this problem
Thanks
I found an entry in a blog that resolved the issue in the following easy way by creating a symbolic link:
For anyone wishing to still use their OS's package of node the simple solution for this is to determine where node is installed on your OS and then create a symbolic link.
For example I had the issue on ubuntu and the install directory is /usr/bin. To create the symlink you can run:
sudo ln -s /usr/bin/nodejs /usr/bin/node
in windows you can use the mklink command.. Be sure to open the command prompt as a administrator
I also got this error. I checked a page showing the response time of the npm registry. It was showing a bit slower response time than normally (around 1700ms 21st of March 2015) so I tried again a few hours later and then it worked.
I did not change any settings or update anything in the mean time so I guess it was some sort of timeout somewhere that caused the error.
I got same error and I fixed it by installing Windows SDK.
If you have visual studio installed you can try to do following thing to install windows SDK:
Go to control panel -> Programs -> uninstall programs -> right click Visual Studio NNNN installer and select"change. It will open visual studio installer and you can modify and select which components you want to install/uninstall. Make sure that you select C++ stuff, it should contain Windows SDK.
If you dont have then you need to download SDK from internet and install it.
Later I also needed to install Python 2.7 to be able to install some npm packages...
Have a try on yarn.
I have tried many method to solve the issue, but the error is not solved yet.
And I tried yarn, it works for me.

Resources