There is a problem when npm install
Opened this issue · 14 comments
I'm new to npm and Nodejs. The following error occur when I do npm install:
/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
What should I do to continue it?
some info:
ubuntu 16.04
node v4.2.6
npm v3.5.2
Make sure you have the C++ compiler installed on your system.
sudo apt install build-essential
@sammaina In your case it's looking for the python executable (Line 2 of the error stack). Please add it to your %PATH%
variable.
Linux-based OSes wont have issues concerning python
because most of those OSes have it installed out of the box
@IOAyman I have gcc installed. The same error is still here. I screen shot the whole message for your reference.
What possibly can it be? Thanks in advance.
@sammaina You can follow the A.3 step of the following link to install python or add python to your PATH. Windows do not have python pre-installed. If you want to install python, please install python 2.7., since npm do not support 3.
http://datastructur.es/sp16/materials/lab/lab1b/lab1b.html#a-windows-setup
Similar happens with macOS, It searches for XCode or CLT but fails and crashes.
I'm having the same issue in Ubuntu 16.04. I verified that I have C++ compiler and Python 2.7.1 installed and in path. Had Node 4, tried updating to 6.9.1, still didn't work. NPM 3.10.9.
This is my stack running npm install (directory = [...]):
> robotjs@0.3.7 install [...]/IAMDinosaur/node_modules/robotjs
> node-gyp rebuild
make: Entering directory '[...]/IAMDinosaur/node_modules/robotjs/build'
CXX(target) Release/obj.target/robotjs/src/robotjs.o
cc1plus: warning: command line option ‘-Wbad-function-cast’ is valid for C/ObjC but not for C++
In file included from ../src/keypress.h:6:0,
from ../src/robotjs.cc:7:
../src/keycode.h:76:23: fatal error: X11/Xutil.h: No such file or directory
compilation terminated.
robotjs.target.mk:113: recipe for target 'Release/obj.target/robotjs/src/robotjs.o' failed
make: *** [Release/obj.target/robotjs/src/robotjs.o] Error 1
make: Leaving directory '[...]/IAMDinosaur/node_modules/robotjs/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/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 Linux 4.4.0-24-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd [...]/IAMDinosaur/node_modules/robotjs
gyp ERR! node -v v6.9.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm ERR! Linux 4.4.0-24-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v6.9.1
npm ERR! npm v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! robotjs@0.3.7 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the robotjs@0.3.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 robotjs 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 robotjs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls robotjs
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! [...]/IAMDinosaur/npm-debug.log
@IOAyman @yangzgnay Thanks it helped. Landed into the same error.
Error: gyp failed with exit code: 1
Guys, it seems it's a bug with the robotjs dependency. I updated line 23 of package.json to
"robotjs": "^0.4.5",
and now npm install
works.
@jotaporras
Still not work on my side after changing ^0.3.7 to ^0.4.5
. The same error appears.
@yangzgnay Maybe take a look at octalmage/robotjs#17 ?
The people there speak about a couple of other dependencies that might be needed. Also consider switching to node 6
Idk but i guess it only works on mac OS.
@jotaporras Works for me. Thanks