Skip to content

Troubleshooting

Dane Springmeyer edited this page Apr 3, 2014 · 3 revisions

Common errors and their solutions

cannot run in wd

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)

Explanation

This is a npm behavior (bug?) when you run as root.

Solution

Solve this by not running as root. Or pass --unsafe-perm to npm install.

node: No such file or directory

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

Explanation

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.

Solution

Install an extra package that fixes this problem:

sudo apt-get install nodejs-legacy

g++: Command not found

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

Explanation

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++.

Solution

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