I am running a node application on terminal. Have recently upgraded to node v8.5.0, but am getting this error:
Error: The module '/tidee/tidee-au/packages/tidee-au-server/node_modules/bcrypt/lib/binding/bcrypt_lib.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 51. This version of Node.js requires
NODE_MODULE_VERSION 57. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
at Object.Module._extensions..node (module.js:653:18)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/tidee/tidee-au/packages/tidee-au-server/node_modules/bcrypt/bcrypt.js:6:16)
at Module._compile (module.js:624:30)
at Module._extensions..js (module.js:635:10)
at Object.require.extensions.(anonymous function) [as .js] (/tidee/tidee-au/packages/tidee-au-server/node_modules/babel-register/lib/node.js:152:7)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/tidee/tidee-au/packages/tidee-au-server/server/helpers/encryptPass.js:1:16)
Any idea how to solve this?
you can see this link
to check your node verison right. using NODE_MODULE_VERSION 51 means that your node version is nodejs v7.x, requires NODE_MODULE_VERSION 57 means you need upgrade your node to v8.x,so you need to upgrade your node. and then you need run
npm rebuild
command to rebuild your projectBe sure you only have one version of NodeJS installed. Try these two:
I initially installed NodeJS from source, but it was the incorrect version and 'upgraded' to the newest version using
nvm
, which doesn't remove any previous versions, and only installs the desired version in the/root/.nvm/versions/...
directory. Sosudo node
was still pointing to the previous version, whilstnode
was pointing to the newer version.You could remove bcrypt entirely and install bcryptjs. It is ~30% slower, but has no dependencies, so no pains installing it.
We've installed it successfully for our applications. We had issues with bcrypt not compiling on AWS instances for Node v8.x
I got this error when running my app with systemd:
But I was using a different version for
npm install
in the shell:If this is your setup, you can either hardcode the node version in the service file or follow a workaround like this one.
Check the Node version you're using, might be a mismatch between what it is expected.
Simply run:
npm uninstall bcrypt
Followed by:
npm install bcrypt
(ornpm install
, if bcrypt is declared as dependency in your package.json file)