-
Notifications
You must be signed in to change notification settings - Fork 264
Troubleshooting
Common errors and their solutions
Error, when running npm install
, looks like:
npm WARN cannot run in wd sqlite3@2.2.0 node-pre-gyp install --fallback-to-build (wd=/usr/home/ec2-user/node-sqlite3)
This is a npm behavior (bug?) when you run as root
.
Solve this by not running as root. Or pass --unsafe-perm
to npm install
.
Error, when installing a module that uses node-pre-gyp, looks like:
/usr/bin/env: node: No such file or directory
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! sqlite3@2.2.0 install: node-pre-gyp install --fallback-to-build
npm ERR! sh "-c" "node-pre-gyp install --fallback-to-build" failed with 127
This is because you are running on debian and installed node via apt packages and the node binary is named nodejs
instead of node
. Only the latter is valid so the packaging of node is broken by default on debian systems.
Install an extra package that fixes this problem:
sudo apt-get install nodejs-legacy
Error, when installing a module that uses node-pre-gyp, looks like:
CXX(target) Release/obj.target/node_sqlite3/src/database.o
gmake: g++: Command not found
gmake: *** [Release/obj.target/node_sqlite3/src/database.o] Error 127
You are missing a C++ compiler. If you are on a debian or other linux system this means you need to install gcc. If you are on FreeBSD or Mac OSX, then you likely want to tell node-gyp to use clang++ instead of g++.
On OS X do:
export CXX=clang++
export CC=clang
# then try installing again
On Free BSD do:
setenv CXX clang++
setenv CC clang
# then try installing again