"node-gyp rebuild" error in mac - node.js

I wanted to follow this page to run JSBin locally.
I just installed xcode 8.2 in my mac. Now, npm -v returns 3.10.9; node -v returns v7.2.1. However, npm install raised errors:
/Users/softtimur/Startup/WebProjects/jsbin$ npm install
> hashring#3.0.0 install /Users/softtimur/Startup/WebProjects/jsbin/node_modules/hashring
> node-gyp rebuild
CXX(target) Release/obj.target/hashvalue/src/hashvalue.o
In file included from ../src/hashvalue.cc:1:
../../nan/nan.h:189:68: error: too many arguments to function call, expected at most 2, have 4
return v8::Signature::New(v8::Isolate::GetCurrent(), receiver, argc, argv);
...
...
...
...
fatal error: too many errors emitted, stopping now [-ferror-limit=]
13 warnings and 20 errors generated.
make: *** [Release/obj.target/hashvalue/src/hashvalue.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Darwin 16.1.0
gyp ERR! command "/usr/local/Cellar/node/7.2.1/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/softtimur/Startup/WebProjects/jsbin/node_modules/hashring
gyp ERR! node -v v7.2.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm WARN mocha-casperjs#0.5.8 requires a peer of casperjs#>= 1.1.0-beta3 but none was installed.
npm ERR! Darwin 16.1.0
npm ERR! argv "/usr/local/Cellar/node/7.2.1/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v7.2.1
npm ERR! npm v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! hashring#3.0.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hashring#3.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 hashring 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 hashring
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls hashring
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/softtimur/Startup/WebProjects/jsbin/npm-debug.log
Does anyone know what's wrong here?

Downgrade Node to v10, like this:
brew uninstall node
brew install node#10
brew link --force --overwrite node#10
npm i should finish without errors now.

The problem is that hashring v3.0.0 depends on an older version of nan (v1.3.x), which is not compatible with recent versions of node. It should be noted that as of this writing, the current version of hashring (v3.2.0) no longer contains an addon, it's javascript only.
The hashring dependency comes from jsbin's memcached dependency, which is currently hard coded to a specific git commit hash. There was a PR to update this dependency a number of months ago but was apparently dismissed because the maintainer(s) are apparently not interested in supporting modern versions of node. You may want to create an issue on their tracker to voice your concern about node compatibility.

Related

install of node-red-contrib-i2c fails with NPM

I have been having problems with my node red installation and the install of additional node packages...I am trying to install the node-red-contrib-i2c package on Raspberry PI http://flows.nodered.org/node/node-red-contrib-i2c ...this is my console output:
pi#raspberrypi:~ $ npm install node-red-contrib-i2c
more console output...then error:
make: Leaving directory '/home/pi/node_modules/node-red-contrib-i2c/node_modules/i2c/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:809:12)
gyp ERR! System Linux 4.4.50-v7+
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/pi/node_modules/node-red-contrib-i2c/node_modules/i2c
gyp ERR! node -v v0.10.29
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! i2c#0.2.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the i2c#0.2.3 install script.
npm ERR! This is most likely a problem with the i2c 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 i2c
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 4.4.50-v7+
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "node-red-contrib-i2c"
npm ERR! cwd /home/pi
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/pi/npm-debug.log
npm ERR! not ok code 0
Something similar happens with several other packages that I have also tried to install including the MCP3008 ADC node package.
Delete your $HOME/.node-gyp.
It should fix your problem
Ok so I ended up solving the problem. What was happening is that the nodejs version that comes pre-installed with the PI is an older version and needs to be upgraded in order to install this particular node for node red so I used:
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install nodejs
This upgrades the nodejs version to version 6 from 0.10.29. 0.10.29 is in the standard Raspberry PI Jessie installation at the time of this writing. Then the installation of the node-red I2C works just fine.

npm install fails with node-gyp build error

Today when I run npm install, it fails and gives me the following error log. I know it's an issue with hashtable but I have never had this issue before.
> hashtable#2.0.2 install /Users/admin/myproject/node_modules/hashtable
> node-gyp configure build
CXX(target) Release/obj.target/native/src/hashtable.o
SOLINK_MODULE(target) Release/native.node
ld: library not found for -lgcc_s.10.5
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Release/native.node] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/admin/.npm-packages/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 15.5.0
gyp ERR! command "/usr/local/bin/node" "/Users/admin/.npm-packages/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /Users/admin/myproject/node_modules/hashtable
gyp ERR! node -v v4.4.7
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
myproject#0.0.1 /Users/admin/myproject
└── (empty)
npm ERR! Darwin 15.5.0
npm ERR! argv "/usr/local/bin/node" "/Users/admin/.npm-packages/bin/npm" "install"
npm ERR! node v4.4.7
npm ERR! npm v3.10.5
npm ERR! code ELIFECYCLE
npm ERR! hashtable#2.0.2 install: `node-gyp configure build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hashtable#2.0.2 install script 'node-gyp configure build'.
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 hashtable package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp configure build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs hashtable
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls hashtable
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/admin/myproject/npm-debug.log
npm ERR! code 1
I thought there might be a problem with node-gyp so I did a npm install node-gyp -g separately but the issue did not go away. Does anyone know how to resolve this?
By the way, I am on Mac,running OSX 10.11.5, also recently installed XCode 6.3.2 for a separate project and can only use this version of XCode, not sure if that is causing the problem.
node-gyp also requires python and xcode on MacOs for C++ compilation. There are similar requirements for other systems.
You can find the pre-reqs for the node-gyp package on its npm page here.

NPM cannot install "truffle" on Windows

I am trying to install "truffle" with npm, but I am not familiar with NodeJS and cant figure out why npm wont install it. I try npm install -g truffle in Powershell with Admin rights and after a few lines of output I get this block of error messages:
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (F:\nodeJS\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "F:\\nodeJS\\node.exe" "F:\\nodeJS\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Max\AppData\Roaming\npm\node_modules\truffle\node_modules\ether-pudding\node_modules\ethereumjs-testrpc\node_modules\ethereumjs-wallet\node_modules\scrypt.js\node_modules\scrypt
gyp ERR! node -v v4.5.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok\
And then after many many yellow lines I finally get this:
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "F:\\nodeJS\\node.exe" "F:\\nodeJS\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "truffle"
npm ERR! node v4.5.0
npm ERR! npm v2.15.9
npm ERR! code ELIFECYCLE
npm ERR! scrypt#6.0.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the scrypt#6.0.3 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the scrypt 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 scrypt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls scrypt
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! F:\eth_truffle\npm-debug.log
After that nothing else happens and after a while it just terminates. There are no files (other than a single log file) in the directory I am currently in and the keyword "truffle" can also not be found by cmd/powershell.
As I said I have never worked with NodeJS before and have no idea what all this means. What I can do to get truffle running?
Your install is failing at node-gyp rebuild. Solutions to this problem are listed on the node-gyp repo. The quickest is:
"Option 1: Install all the required tools and configurations using Microsoft's windows-build-tools using npm install --global --production windows-build-tools from an elevated PowerShell or CMD.exe (run as Administrator)." This will install Python and Visual Studio correctly.
Also, you are using Node 4.5. The recommended version is 5+, according to the Truffle Docs
I was also facing the same problem...
Solution:
Run as administrator
npm install --global windows-build-tools
npm install -g truffle

Error installing bcrypt with NPM in meteor

I've searched around for a couple of days trying to resolve this issue, and although people have had issues installing bcrypt with NPM, they don't appear to be like mine. For those of you finding this via Google, I suggest you also take a look at this post.
Now I get the following error, as do others, when installing bcrypt:
> bcrypt#0.8.7 install /home/william/bonsai/brain/src/hyperdev/node_modules/bcrypt
> node-gyp rebuild
/bin/sh: 1: node: not found
gyp: Call to 'node -e "require('nan')"' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/share/node-gyp/lib/configure.js:354:16)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 4.4.0-28-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/william/bonsai/brain/src/hyperdev/node_modules/bcrypt
gyp ERR! node -v v4.2.6
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
hyperdev# /home/william/bonsai/brain/src/hyperdev
└── touch#1.0.0 extraneous
npm ERR! Linux 4.4.0-28-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "bcrypt"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! bcrypt#0.8.7 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt#0.8.7 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 bcrypt 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 bcrypt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls bcrypt
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/william/bonsai/brain/src/hyperdev/npm-debug.log
I have all of bcrypt's dependencies installed, so I am genuinely unsure of how to proceed. Here is the npm debug log needed.
I think this is a known bug in Meteor.
I use debian8.6-64bit.
I remove accounts-password and npm-bcrypt, and then I do
meteor add npm-bcrypt
meteor npm install -g node-gyp
meteor npm install --save bcrypt
meteor npm install --save babel-runtime
meteor add accounts-password
Finally, I fix the bug. I'm not sure of its effectiveness, if you change order of command.

Error installing node-weak on Windows7

I can't seem to load node-weak on Windows7. I've tried Python 2.7, 2.5, 2.3, to no avail. It seems (from the error below), that I need to use a version of Python2, but changing versions doesn't seem to help. Any help is appreciated.
C:\project1\node_modules\weak>node "C:\Program Files (x86)\nodejs\node_modules\npm\
bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
gyp ERR! rebuild error Error: Python executable "c:\Python25\python.exe" is Pyth
on 3, which is not supported.
gyp ERR! rebuild error at failPython3 (C:\Program Files (x86)\nodejs\node_mo
dules\npm\node_modules\node-gyp\lib\configure.js:90:14)
gyp ERR! rebuild error at C:\Program Files (x86)\nodejs\node_modules\npm\nod
e_modules\node-gyp\lib\configure.js:79:9
gyp ERR! rebuild error at ChildProcess.exithandler (child_process.js:534:7)
gyp ERR! rebuild error at ChildProcess.EventEmitter.emit (events.js:91:17)
gyp ERR! rebuild error at maybeClose (child_process.js:634:16)
gyp ERR! rebuild error at Process._handle.onexit (child_process.js:676:5)
gyp ERR! not ok
npm ERR! weak#0.2.1 install: `node-gyp rebuild`
npm ERR! `cmd "/c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the weak#0.2.1 install script.
npm ERR! This is most likely a problem with the weak 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 weak
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program File
s (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "weak"
npm ERR! cwd C:\project1
npm ERR! node -v v0.8.1
npm ERR! npm -v 1.1.33
npm ERR! code ELIFECYCLE
npm ERR! message weak#0.2.1 install: `node-gyp rebuild`
npm ERR! message `cmd "/c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\project1\npm-debug.log
npm ERR! not ok code 0
Apparently node-gyp#0.5.2 had a bug where it wouldn't parse the Python version number properly, but that was fixed in 036a730f4a3a95e65d8f390f7f5c4f0d3321e422 (0.5.3). To fix the issue, I had to update node-gyp:
cd "C:\Program Files (x86)\nodejs"
npm install node-gyp
Simple solution, but a difficult problem to track down.
I had a similar issue on Virtual box on Linux Mint in Windows 7 host. The nodejs(v0.6.19) and npm(v1.1.14) libs I procured through apt-get were outdated. I installed both npm(v1.3.11) and nodejs(v0.10.20) through source code from here.
I encountered errors when compiling the code in shared folder as symbolic links creation is disabled in shared folders. So, I extracted zips, compiled and installed these files outside the shared folders. This resolved the issue straightaway.

Resources