I'm fairly clueless as to what I actually found here. This could be my own fault, but I'm really not sure where else to ask, so I apologize in advance if so.
I just installed the newest _stable_ node release (v0.12.0), and used npm to install bcrypt.
The install went fine, apparently. I got no warns and it said "OK" at the end.
When I tried to require('bcrypt') in my app, i got this:
.../node_modules/bcrypt/node_modules/bindings/bindings.js:79
throw e
^
Error: .../node_modules/bcrypt/build/Release/bcrypt_lib.node: undefined symbol: node_module_register
at Object.Module._extensions..node (module.js:485:11)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at bindings (.../node_modules/bcrypt/node_modules/bindings/bindings.js:74:15)
at Object.
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
Do you have any suggestions?
I see the same error using [email protected] and [email protected] with [email protected].
Error: ./node_modules/bcrypt/build/Release/bcrypt_lib.node: undefined symbol: node_module_register
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at bindings (./node_modules/bcrypt/node_modules/bindings/bindings.js:74:15)
at Object.<anonymous> (./node_modules/bcrypt/bcrypt.js:3:35)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
Looks like it's not just affecting bcrypt
https://github.com/TooTallNate/node-bindings/issues/17
+1 having the same binding issues running node v0.12
I had a similar issue after updating to node v0.12. In my case, running npm update (for other non-bcrypt modules in my project) then upgrading the bcrypt version in package.json (I previously had 0.7.x), and then running npm install solved it for me. Posting here in case it helps others
+1 having the same problem after installing 0.12
Found the solution. delete your node_modules and npm i
@leore, you want to tell us how to do that? Or for that matter, what it does and why it works?
@wmodes, within your project directory, rm -Rf node_modules; npm install .
No dice. Still get same error.
/home/secrethistory/bundle/programs/server/node_modules/fibers/future.js:245
throw(ex);
^
Error: Module did not self-register.
at Error (native)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at bindings (/home/secrethistory/bundle/programs/server/npm/npm-bcrypt/node_modules/bcrypt/node_modules/bindings/bindings.js:74:15)
at Object.<anonymous> (/home/secrethistory/bundle/programs/server/npm/npm-bcrypt/node_modules/bcrypt/bcrypt.js:3:35)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
More suggestions?
A workaround for this problem was suggested here: http://stackoverflow.com/questions/29340510/bcrypt-is-breaking-my-meteor-application-how-do-i-fix-it/29347616
rm -rfing the node_modules directory and reinstalling/compiling didn't do anything for me. Uninstalling node and reinstalling didn't do anything for me either.
If you are in the crowd who's having problems after upgrading to Node 12, it may be because your node-gyp version is still v10. Run node-gyp -v if it says v10, then you'll want to do sudo npm update node-gyp -g and then re-install bcrypt. This is required because node-gyp is what compiles bcrypt on npm install/update so it's version needs to match your node's version. I did a fairly bogus manual installation of node and ended up in this scenario.
I have node-gyp v13 and I am still having this problem :/
@renatoargh Yesterday I had to re-install bcrypt for Node on Centos 6 for versions: 0.10.33, 0.12.7, 4.2.2, and 5.0.0. When I did it for Node 12+ I utilized this tutorial http://braaten-family.org/ed/blog/2014-05-28-devtools-for-centos/ . When you drop into scl enable devtoolset-2 bash I'm able to run npm install bcrypt and it will compile. Does that work possibly?
I was able to resolve this issue using npm install bcrypt which downloaded the same version I already had and recompiled it using node-gyp. I think it just needs to be recompiled after the update to node 0.12.x.
Also, verify your bcrypt version is the correct one that matches the version of node you are using from the documentation
For me it happened because of mismatching npm versions. I had installed bcrypt with npm version 3.8 and was trying to use it with 2.x.
sometimes its the privilege error, i tried to run sudo npm ...
and it worked
I use this command and fix my problem:
npm rebuild bcrypt --build-from-source
Same Problem exist when project deployed to HEROKU using hobby-dev postgresql as database saying - 'invalid character' by checking in heroku logs.
Resolved by setting Nodejs and Bcrypt to latest version in Engine of package.json .
I had a similar issue after updating to node v0.12. In my case, running
npm update(for other non-bcrypt modules in my project) then upgrading the bcrypt version in package.json (I previously had 0.7.x), and then runningnpm installsolved it for me. Posting here in case it helps others
I use this command and fix my problem:
npm rebuild bcrypt --build-from-source
I and fix the same problem with this command : npm rebuild bcrypt --build-from-source
for Debian 10 and node v8.16.0
Most helpful comment
I use this command and fix my problem:
npm rebuild bcrypt --build-from-source