TryGhost/Ghost

Can't compile node-sqlite3 on Debian Wheezy

codelitt opened this issue · 4 comments

I've followed the recommendations you have set for installation errors with sqlite and still when I run:

sudo npm install sqlite3 --build-from-source

The Eerror below occurs

See <file:///usr/share/doc/gcc-4.7/README.Bugs> for instructions.
make: *** [Release/obj.target/sqlite3/gen/sqlite-autoconf-3080200/sqlite3.o] Error 4
make: Leaving directory `/var/www/ghost/node_modules/sqlite3/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:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.2.0-4-amd64
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-    gyp/bin/node-gyp.js" "rebuild" "--fallback-to-build"
gyp ERR! cwd /var/www/ghost/node_modules/sqlite3
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.13.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp rebuild --fallback-to-build'     (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous>     (/var/www/ghost/node_modules/sqlite3/node_modules/node-pre-    gyp/lib/util/compile.js:31:29)
node-pre-gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
node-pre-gyp ERR! stack     at maybeClose (child_process.js:743:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit     (child_process.js:810:5)
node-pre-gyp ERR! System Linux 3.2.0-4-amd64
node-pre-gyp ERR! command "node""/var/www/ghost/node_modules/sqlite3/node_modules/.bin/node-pre-gyp" "install" "--        fallback-to-build"
node-pre-gyp ERR! cwd /var/www/ghost/node_modules/sqlite3
node-pre-gyp ERR! node -v v0.10.26
node-pre-gyp ERR! node-pre-gyp -v v0.2.6
node-pre-gyp ERR! not ok 
npm ERR! sqlite3@2.2.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the sqlite3@2.2.0 install script.
npm ERR! This is most likely a problem with the sqlite3 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install --fallback-to-build
npm ERR! You can get their info via:
npm ERR!     npm owner ls sqlite3
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.2.0-4-amd64
npm ERR! command "node" "/usr/bin/npm" "install" "sqlite3" "--build-from-source"
npm ERR! cwd /var/www/ghost
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.7
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /var/www/ghost/npm-debug.log
npm ERR! not ok code 0

The error message advises you to report that to the author of the node-sqlite3 module. We can't help you a whole lot with this I'm afraid.

Hi @codelitt, please take a look around the node-sqlite3 repository https://github.com/mapbox/node-sqlite3/issues, make sure you have the dependencies: https://github.com/TooTallNate/node-gyp#installation and if you're still stuck raise an issue on the node-sqlite3 repo.

small addition,
try to rebuild sqlite3 by adding a python interpreter to the command

npm install sqlite3 --build-from-source --python=/usr/local/bin/python2.7

@skat-delayed Ya. It turns out I just need to not build it from source, but not as sudo. Running it normally fixed it. Just didn't catch it till someone pointed it out.