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

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!

Related

Error with installing browsersync for node js through command prompt

A little background: I have a Windows 10 laptop with 8.3 gigs of usable space(6.3 gigs are python, so 2 gigs of usable space), so I install and download everything onto an external hard drive. Unfortunately, my previous external hard drive started malfunctioning and physically falling apart after less than 6 months, so I've been in the process of moving files and reinstalling programs to my new hard drive. Recently I joined a MOOC that asked me to download Node JS and install browsersync on it.
I installed Node JS and tested it and npm with -version, and both were installed. I closed and reopened the cmd. However, when I ran npm install -g browser-sync it gave me the following: cmd errors
The first error is due to a typo, but the second error is the real one.
Here is the true error in text:
Microsoft Windows [Version 10.0.10240]
C:\Users\Bracklinn>npm install -g -browser-sync
npm ERR! addLocal Could not install C:\Users\Bracklinn
npm ERR! Windows_NT 10.0.10240
npm ERR! argv "D:\\Programs\\NodeJs\\node.exe" "D:\\Programs\\NodeJs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "-browser-sync"
npm ERR! node v4.4.7
npm ERR! npm v2.15.8
npm ERR! code EISDIR
npm ERR! errno -4068
npm ERR! syscall read
npm ERR! eisdir EISDIR: illegal operation on a directory, read
npm ERR! eisdir This is most likely not a problem with npm itself
npm ERR! eisdir and is related to npm not being able to find a package.json in
npm ERR! eisdir a package you are trying to install.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Bracklinn\npm-debug.log
I tried uninstalling and reinstalling, googled it a bunch of times, and just ended up wasting 2 hours. I think it has something to do with my cmd is in my computer drive but node.js is on my hard drive. So I've turned here for help.
Thanks in advance!

NPM Install Error - Node-Pre-Gyp

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

‘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/

npm install: 'bower install' exited with error code 1

I want to programm widgets for XBee ZigBee Cloud Kit.
To do it, I need first to set up everything.
I'm using this guide.
After failing repeatedly the automated setup I started the Manual setup. I did install the Requirements. So everything so far went good until the last point: npm install. I'm getting the following error bower install' exited with error code 1. I'm not sure what to do, I'm not used to PowerShell or any other shell.
After failing the installing I get this errors:
bower justgauge#* ECMDERR Failed to
execute "git ls-remote --tags --heads git://github.c
om/oscarcv/justgage.git", exit code of #128 fatal: remote error:
Repository not found.
Additional error details: fatal: remote error: Repository
not found.
'bower install' exited with error code 1
npm ERR! Windows_NT 6.1.7601 npm ERR! argv "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "i nstall"
npm ERR! node v0.12.4
npm ERR! npm v2.10.1
npm ERR! code ELIFECYCLE
npm ERR! xbee-zigbee-cloud-kit#1.0.0 postinstall: node postinstall.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the xbee-zigbee-cloud-kit#1.0.0 postinstall script 'node postinstall.js'.
npm ERR! This is most likely a problem with the xbee-zigbee-cloud-kit package,
npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system:
npm ERR! node postinstall.js npm ERR!
You can get their info via:
npm ERR! npm owner ls xbee-zigbee-cloud-kit
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\steim\Desktop\XBeeZigBeeCloudKit-master\npm-debug.log
"This is most likely a problem with the xbee-zigbee-cloud-kit package"
If this is true, in that case I don't know what to do, because I work with this package.
This is the npm-debug.log. (Sorry I can't post the whole log, too many characters).
I'm using a company laptop:
Latitude D820
Windows 7 32 Bit
Windows PowerShell with Administration
I'm grateful for any kind of help. I'm getting headache trying to figure it out.
I could solve it. And can now run the app now localy.
I did this steps to solve the issue:
Deleting justgage in bower.json file.
Using commandline: bower install justgage-official
Using commandline: bower update
The only problem is actually I can't start with foreman start (but it's another issue), instead I use python manage.py runserver 0.0.0.0:5000. After that in browser: http://localhost:5000
Thanks Etan Reisner for the hint and thanks Oscar Costoya for guiding me.

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