Search code examples
node.jsmongodbbeagleboneblacknode-gyp

npm install mongodb fails (seems node-gyp related)


I have a Node.JS webserver hosted on my BeagleBone Black at home and I'd like to interface it with mongodb, so the natural thing to do was npm install mongodb.

Obviously, it didn't work. I've googled it but didn't find my solution.

Here's (part of) what the command outputs :

make: *** [Release/obj.target/validation/src/validation.o] Error 1                                                                     
make: Leaving directory `/home/fointard/NodeJs/node_modules/utf-8-validate/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: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 Linux 3.8.13-bone72
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 /home/fointard/NodeJs/node_modules/utf-8-validate
gyp ERR! node -v v5.0.0
gyp ERR! node-gyp -v v3.2.1
gyp ERR! not ok
npm WARN install:utf-8-validate utf-8-validate@1.2.1 install: `node-gyp rebuild`
npm WARN install:utf-8-validate Exit status 1

npm WARN ENOENT ENOENT: no such file or directory, open '/home/fointard/NodeJs/package.json'
npm WARN EPEERINVALID mongodb-core@1.2.26 requires a peer of kerberos@~0.0 but none was installed.
npm WARN EPACKAGEJSON /home/fointard/NodeJs No description
npm WARN EPACKAGEJSON /home/fointard/NodeJs No repository field.
npm WARN EPACKAGEJSON /home/fointard/NodeJs No README data
npm WARN EPACKAGEJSON /home/fointard/NodeJs No license field.

It seems like node-gyp fails to build some dependencies.

uname -a

gives

Linux haystack 3.8.13-bone72 #1 SMP Tue Jun 16 21:36:04 UTC 2015 armv7l GNU/Linux

and

lsb_release -da

gives

Distributor ID: Debian                                                                                                                 
Description:    Debian GNU/Linux 7.9 (wheezy)                                                                                          
Release:        7.9                                                                                                                    
Codename:       wheezy

Anyone having insights to share ? It'd be very welcome !

EDIT : I solved the problem. Seems like the issue was caused by my C++ compiler (G++ 4.6.x) which did not support C++11.

  1. Upgrade from Debian Wheezy to Jessie (7.x to 8.x)
  2. GCC 4.9.2 was already installed, it supports C++11 whereas my old 4.6.x version did not
  3. sudo apt-get install libkrb5-dev : required to build node.js kerberos module
  4. npm install kerberos : manual install is required as npm v3.x+ doesn't install it by itself
  5. npm install mongodb : done

Fointard


Solution

  • I solved the problem. Seems like the issue was caused by my C++ compiler (G++ 4.6.x) which did not support C++11.

    1. Upgrade from Debian Wheezy to Jessie (7.x to 8.x)
    2. GCC 4.9.2 was already installed, it supports C++11 whereas my old 4.6.x version did not
    3. sudo apt-get install libkrb5-dev : required to build node.js kerberos module
    4. npm install kerberos : manual install is required as npm v3.x+ doesn't install it by itself
    5. npm install mongodb : done

    Fointard