"node build.js" fails when trying to install grunt-sass - node.js

I'm trying to switch from grunt-contrib-sass to grunt-sass, but I'm running into build errors related to node-sass inside the grunt wrapper module. So far I've upgraded node from 0.10.40 to 0.12.7 and switched to Python 2.7 in order to bypass a few other others, but this is what remains:
$ npm install
> node-sass#1.0.3 install /var/www/html/example.com/www/node_modules/grunt-sass/node_modules/node-sass
> node build.js
child_process: customFds option is deprecated, use stdio instead.
make: Entering directory `/var/www/html/example.com/www/node_modules/grunt-sass/node_modules/node-sass/build'
CXX(target) Release/obj.target/binding/binding.o
cc1plus: error: unrecognized command line option "-std=c++11"
cc1plus: error: unrecognized command line option "-std=c++11"
make: *** [Release/obj.target/binding/binding.o] Error 1
make: Leaving directory `/var/www/html/example.com/www/node_modules/grunt-sass/node_modules/node-sass/build'
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:269:23)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Linux 2.6.18-274.18.1.el5.centos.plus
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/www/html/example.com/www/node_modules/grunt-sass/node_modules/node-sass
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok
Build failed
npm ERR! Linux 2.6.18-274.18.1.el5.centos.plus
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! code ELIFECYCLE
npm ERR! node-sass#1.0.3 install: `node build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass#1.0.3 install script 'node build.js'.
npm ERR! This is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node build.js
npm ERR! You can get their info via:
npm ERR! npm owner ls node-sass
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /var/www/html/example.com/www/npm-debug.log
Additional version info:
$ node -v
v0.12.7
$ node -v
v0.12.7
$ npm -v
2.11.3
$ cat /etc/redhat-release
CentOS release 5.11 (Final)
I'm a bit out of my depth on troubleshooting Node.js compatibility problems. While this is on a shared dev environment, I'm willing to try just about anything short of massive global change like upgrading the OS.
Update: I've since solved this by manually removing node-sass and node-gyp from the local node_modules folder. After that running npm install ran without errors. I think those modules were leftover from earlier attempts (before upgrading node.js and Python, most likely).

Related

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 fails installing zmq on OSX 10.9.5

I'm getting this error:
/bin/sh: pkg-config: command not found
gyp: Call to 'pkg-config libzmq --libs' returned exit status 127. while trying to load binding.gyp
I've tried upgrading nodejs to 5.1.0.
I've tried downgrading nodejs to 4.2.2.
I've tried completely removing nodejs manually then re-installing 4.2.2 and trying again.
I've tried the removal script here:
https://gist.github.com/brock/5b1b70590e1171c4ab54
Then re-installing each version and trying again.
I've tried downgrading to zeromq 4.0.7.
No luck.
Here's the complete error:
localhost:~ user$ npm install zmq
/
> zmq#2.14.0 install /Users/user/node_modules/zmq
> node-gyp rebuild
/bin/sh: pkg-config: command not found
gyp: Call to 'pkg-config libzmq --libs' returned exit status 127. 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/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:355: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 Darwin 13.4.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/user/node_modules/zmq
gyp ERR! node -v v4.2.2
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm ERR! Darwin 13.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "zmq"
npm ERR! node v4.2.2
npm ERR! npm v2.14.7
npm ERR! code ELIFECYCLE
npm ERR! zmq#2.14.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the zmq#2.14.0 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the zmq 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 zmq
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/user/npm-debug.log
Here's what worked...
install zmq using brew : brew install zmq
export PKG_CONFIG_PATH=/usr/local/Cellar/zeromq/4.0.4/lib/pkgconfig/
sudo visudo
add the line Defaults env_keep += "PKG_CONFIG_PATH"
sudo npm install zmq
Here is how I fixed it:
Step 1:
brew install zmq
Step 2:
export PKG_CONFIG_PATH=/usr/local/Cellar/zeromq/4.2.5/lib/pkgconfig/
(Note: zeromq Version 4.2.5 in path above will need to be changed to whatever version you installed)
Step 3:
sudo visudo
and add
Defaults env_keep += "PKG_CONFIG_PATH"
Step 4:
In package.json > dependencies, add:
"zmq": "^2.15.3"
Step 5:
Run yarn or npm install

libtool error "no option: -static" while installing/compiling openzwave

npm install openzwave fails - compilation fails. libtool error: no option "-static"
Darwin 13.3.0 Darwin Kernel Version 13.3.0, MacBookPro11,2 Darwin
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:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:810:12)
gyp ERR! System Darwin 13.3.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/me/git/node-zwaveTest/node_modules/openzwave
gyp ERR! node -v v0.10.33
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok
npm ERR! Darwin 13.3.0
npm ERR! argv "node" "/usr/local/bin/npm" "instal" "openzwave"
npm ERR! node v0.10.33
npm ERR! npm v2.1.6
npm ERR! code ELIFECYCLE
npm ERR! openzwave#0.0.32 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the openzwave#0.0.32 install script.
npm ERR! This is most likely a problem with the openzwave 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 openzwave
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/me/git/node-zwaveTest/npm-debug.log
Problem: multiple libtools installed on system. Need to use the one in /usr/bin/. Change path, or change build file depending on install mathod.
npm method
$ export PATH=/usr/local/bin:$PATH
$ npm instal openzwave
From source:
$ svn checkout http://open-zwave.googlecode.com/svn/trunk/ open-zwave-read-only
$ make (fails, but creates build directory we need)
$ vi ./cpp/build/support.mk
(Find AR := line and change libtool to /usr/bin/libtool, save, quit)
$ make
fun and profit.
Although this question is more than 18 months old now, I think you should try installing the latest OpenZWave and then try installing openzwave-shared (npm install openzwave-shared). This is a node addon (that began as a fork of the node package you're trying to install) which decouples the compilation of the underlying OpenZWave C++ library as it links to it dynamically.

Raspberry Pi opencv 3 and node-opencv

I successfully compiled opencv 3 on my raspberry pi raspbian system. Now i am trying since ages to get node-opencv to install but with not much success.
Here is the error output from npm
npm install -g opencv
|
opencv#1.0.0 install /usr/local/lib/node_modules/opencv
node-gyp rebuild
make: Entering directory '/usr/local/lib/node_modules/opencv/build'
CXX(target) Release/obj.target/opencv/src/init.o
In file included from ../src/init.cc:5:0:
../src/CascadeClassifierWrap.h:5:3: error: ‘CascadeClassifier’ in namespace ‘cv’ does not name a type
In file included from ../src/init.cc:6:0:
../src/VideoCaptureWrap.h:5:7: error: ‘VideoCapture’ in namespace ‘cv’ does not name a type
opencv.target.mk:99: recipe for target 'Release/obj.target/opencv/src/init.o' failed
make: *** [Release/obj.target/opencv/src/init.o] Error 1
make: Leaving directory '/usr/local/lib/node_modules/opencv/build'
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:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:810:12)
gyp ERR! System Linux 3.12.28+
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/opencv
gyp ERR! node -v v0.10.33
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok
npm ERR! opencv#1.0.0 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the opencv#1.0.0 install script.
npm ERR! This is most likely a problem with the opencv 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 opencv
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.12.28+
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "opencv"
npm ERR! cwd /usr/local/include/opencv
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0
I really am out of ideas and would much apprichiate some major help here.
Thanks a lot
best regards Thomas
node-opencv does not fully support OpenCV 3.x yet. They mention it on the readme here. You should be able to install 2.4 on your RPi2 with this tutorial, or search that same site if you have an RPi3.

Errors installing pty.js (node) on OS X

I have run into an unusal problem when trying to install pty.js using node:
If I run npm install pty.js I receive this error:
> node-gyp rebuild
CXX(target) Release/obj.target/pty/src/unix/pty.o
../src/unix/pty.cc:487:10: error: use of undeclared identifier 'openpty'
return openpty(amaster, aslave, name, (termios *)termp, (winsize *)winp);
^
../src/unix/pty.cc:533:10: error: use of undeclared identifier 'forkpty'
return forkpty(amaster, name, (termios *)termp, (winsize *)winp);
^
2 errors generated.
make: *** [Release/obj.target/pty/src/unix/pty.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: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 Darwin 13.3.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/otiswright/Developer/Projects/Web/Hatchway/node_modules/pty.js
gyp ERR! node -v v0.10.29
gyp ERR! node-gyp -v v0.13.1
gyp ERR! not ok
npm ERR! pty.js#0.2.4 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pty.js#0.2.4 install script.
npm ERR! This is most likely a problem with the pty.js 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 pty.js
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 13.3.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "pty.js"
npm ERR! cwd /Users/otiswright/Developer/Projects/Web/Hatchway
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.5.0-alpha-4
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/otiswright/Developer/Projects/Web/Hatchway/npm-debug.log
npm ERR! not ok code 0
I have node-gyp installed am running OS X with xcode + commandlines installed.
I am not sure where the problem is occurring? Could be dependencies.
I had the same issue with a different node package devtools-terminal.
The problem is that a header file is configured incorrectly for OSX as explained here.
This is the work around I use:
mkdir /tmp/pty.js
git clone https://github.com/chjj/pty.js.git /tmp/pty.js
vi /tmp/pty.js/src/unix/pty.cc
replace line 39: #include <util.h> with #include "/usr/include/util.h"
npm install -g /tmp/pty.js
and now npm install -g devtools-terminal should work.
This way you fix the issue in pty.js and use your local copy as the dependency for the package you with to install.
Good luck!

Resources