Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm install mongoose fails (kerberos and bson errors)

So I'm attempting to launch my node app, but there's a few errors arising from my MongoDB installation.

Here are the specs for my dev environment:

node => 0.10.33 (installed from nodejs.org)

npm => 1.4.28 (installed from nodejs.org)

git => 2.1.3 (homebrewed)

mongodb => 2.6.5 (homebrewed)

If it makes a difference, I am also using the Mean Stack Skeleton as part of a tutorial.

In a nutshell, when I try to run my node app using $ node app.js, I get the following feedback:

USER$ npm install mongoose

> [email protected] install /Users/USER/APP/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos
> (node-gyp rebuild 2> builderror.log) || (exit 0)

  CXX(target) Release/obj.target/kerberos/lib/kerberos.o
  CXX(target) Release/obj.target/kerberos/lib/worker.o
  CC(target) Release/obj.target/kerberos/lib/kerberosgss.o
  CC(target) Release/obj.target/kerberos/lib/base64.o
  CXX(target) Release/obj.target/kerberos/lib/kerberos_context.o
  SOLINK_MODULE(target) Release/kerberos.node
  SOLINK_MODULE(target) Release/kerberos.node: Finished

> [email protected] install /Users/USER/APP/node_modules/mongoose/node_modules/mongodb/node_modules/bson
> (node-gyp rebuild 2> builderror.log) || (exit 0)

  CXX(target) Release/obj.target/bson/ext/bson.o
  SOLINK_MODULE(target) Release/bson.node
  SOLINK_MODULE(target) Release/bson.node: Finished
[email protected] node_modules/mongoose
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
└── [email protected] ([email protected], [email protected], [email protected])

I checked the builderror.log files for both the kerberos and bson modules. However, both are empty.

Some research I have found suggests that the issue might be because my node-gyp installation does not have a corresponding binding.gyp file.

Also tried running $ node-gyp configure inside my Node.js project folder. And this is the error I received:

gyp: binding.gyp not found (cwd: /Users/USER/APP) while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/node-gyp/lib/configure.js:343:16)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:810:12)
gyp ERR! System Darwin 12.5.0
gyp ERR! command "node" "/usr/local/bin/node-gyp" "configure"
gyp ERR! cwd /Users/USER/APP
gyp ERR! node -v v0.10.33
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok

Any ideas why I am having these issues?

EDIT: After setting the port in my app.js file to set the port to the same one that the Express server is listening on (duh), I get more feedback indicating that I was using Mongoose 3.9.4, which is the latest unstable release of mongoose. So I set the module to 3.8.18 in my package.json and attempted to reinstall the module. I received the same errors. However, the unstable release feedback is gone now.

like image 835
Caleb Faruki Avatar asked Nov 05 '14 22:11

Caleb Faruki


3 Answers

For anyone on a Linux distro ensure you have libkrb5-dev (or your distro's similar package) installed. This will take care of many build errors with bson and kerberos.

like image 50
TWright Avatar answered Nov 06 '22 15:11

TWright


For ubuntu users, first uninstall moongose

npm uninstall mongoose --save

then install the a kerberos update

apt-get install libkrb5-dev

then "install" moongose again

npm install mongoose --save

I hope this helps somebody there.

like image 26
pedrommuller Avatar answered Nov 06 '22 14:11

pedrommuller


I've fixed this by installing node-gyp into the global scope. Hope it helps.

$ npm install -g node-gyp 
like image 14
Wreeecks Avatar answered Nov 06 '22 16:11

Wreeecks