Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm install -g node-gyp fails #418

Closed
siddhion opened this issue Mar 21, 2014 · 10 comments
Closed

npm install -g node-gyp fails #418

siddhion opened this issue Mar 21, 2014 · 10 comments

Comments

@siddhion
Copy link

I've been having been trying to get MongoDB to start up properly with my Express.js app but when I run node app.js I get the Failed to load c++ bson extension, using pure JS version error. I should mention that when I ran npm install to install all the modules listed in package.json I got these two errors.

> kerberos@0.0.3 install /home/max/dev/3lf2/node_modules/mongodb/node_modules/kerberos
> (node-gyp rebuild 2> builderror.log) || (exit 0)

> bson@0.2.5 install /home/max/dev/3lf2/node_modules/mongodb/node_modules/bson
> (node-gyp rebuild 2> builderror.log) || (exit 0)

So I figured it was a problem with node-gyp. This is holding me back from moving forward with learning about Express and MongoDB. I'm not sure how to proceed so any help is super appreciated.

@smartmouse
Copy link

Hi,I get this warning message too, but it should not holding you up from learning.
My application still run perfectly fine because the pure JS version is used instead of the native implementation. or may be I have not exercised the path that run into the issue yet.
What is the implication? I do not know, you should go back to the module owner who spills out the warning message to find out. For my usages, so far, I did not see any differences in the expected behavior but I would thinking tha using native code may have better performance.
kerberos and bson are natives and will be compiled on the native module.

@siddhion
Copy link
Author

I see what you mean about me learning but putting that aside, node-gyp should be working properly here and it is not. This is about making sure node-gyp functions as it should with out error.

@smartmouse
Copy link

agree.

@TooTallNate
Copy link
Contributor

Did you change the original post? The issue title now has nothing to do with the issue contents...

fwiw, you do not need to npm install -g node-gyp to simply install node modules that require compilation. npm comes bundled with its own copy of node-gyp, so it's not necessary.

So what's inside the builderror.log file?

@siddhion
Copy link
Author

The issue I am having is with the node-gyp that came with npm. The following two errors are a result of me running npm install in a project that contains "mongodb": ">= 0.9.6-7" as one of it's dependencies in package.json.

> kerberos@0.0.3 install /home/max/dev/3lf2/node_modules/mongodb/node_modules/kerberos
> (node-gyp rebuild 2> builderror.log) || (exit 0)

> bson@0.2.5 install /home/max/dev/3lf2/node_modules/mongodb/node_modules/bson
> (node-gyp rebuild 2> builderror.log) || (exit 0)

These two errors are responsible for the fact that I get the Failed to load c++ bson extension, using pure JS version error when running my Express app.

Yes I changed the post but forgot the title. Originally I had posted the full issue here https://github.com/mongodb/js-bson/issues/58#issuecomment-38272458 and attempted to solve it with the solutions provided by some of the commenters. None of those solutions worked. I doubt my post will see any attention since it is a closed topic.

When I run npm install -g node-gyp I get the following error. There is no builderror.log file associated with node-gyp. I even looked all over in /usr/lib/node_modules/node-gyp and /usr/bin/node-gyp.

$ sudo npm install -g node-gyp
[sudo] password for max: 
npm http GET https://registry.npmjs.org/node-gyp
npm http 304 https://registry.npmjs.org/node-gyp
npm ERR! error rolling back Error: Refusing to delete: /usr/bin/node-gyp not in /usr/lib/node_modules/node-gyp
npm ERR! error rolling back     at clobberFail (/usr/lib/node_modules/npm/lib/utils/gently-rm.js:57:12)
npm ERR! error rolling back     at next (/usr/lib/node_modules/npm/lib/utils/gently-rm.js:43:14)
npm ERR! error rolling back     at /usr/lib/node_modules/npm/lib/utils/gently-rm.js:52:12
npm ERR! error rolling back     at Object.oncomplete (fs.js:107:15)
npm ERR! error rolling back  node-gyp@0.13.0 { [Error: Refusing to delete: /usr/bin/node-gyp not in /usr/lib/node_modules/node-gyp] code: 'EEXIST', path: '/usr/bin/node-gyp' }
npm ERR! Refusing to delete: /usr/bin/node-gyp not in /usr/lib/node_modules/node-gyp
File exists: /usr/bin/node-gyp
Move it away, and try again. 

npm ERR! System Linux 3.11.0-18-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "node-gyp"
npm ERR! cwd /home/max/dev/3lf/node_modules/mongodb/node_modules/bson
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! path /usr/bin/node-gyp
npm ERR! code EEXIST
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/max/dev/3lf/node_modules/mongodb/node_modules/bson/npm-debug.log
npm ERR! not ok code 0

@siddhion
Copy link
Author

So I deleted my node_modules directory in my project and ran npm install again. I got a pop up window telling me that gyp_main.py has stopped working. I sent an error report in.

gyp_mainpy

And here is the full output of running npm install with the bson and kerberos node-gyp build errors.
https://gist.github.com/siddhion/9780803

@tminglei
Copy link

Any progress? I'm also pending on this.

@tharrington
Copy link

This has been a nightmare for me as well, have you made any progress?

@jbhelfrich
Copy link

The (node-gyp rebuild 2> builderror.log) || (exit 0) is just telling you to run it again so you get the error log, in case it hasn't been generated.

If you're getting this error, check your python version. If's it's 3+, node-gyp won't work. Install python v2 for your system. You can then go to the affected module(s) (/home/max/dev/3lf2/node_modules/mongodb/node_modules/kerberos and /home/max/dev/3lf2/node_modules/mongodb/node_modules/bson in the example above) and run
node-gyp rebuild --python /your/path/to/python2 and the modules should rebuild.

@TooTallNate
Copy link
Contributor

Should be fixed by #527.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants