Node.bcrypt.js: Incorrect NODE_MODULE_VERSION

Created on 15 Dec 2017  路  6Comments  路  Source: kelektiv/node.bcrypt.js

After doing a deployment to a Ubuntu, trying to start the project throws an error.

module.js:664
  return process.dlopen(module, path._makeLong(filename));
                 ^

Error: The module '/home/user/ml-interface/node_modules/bcrypt/lib/binding/bcrypt_lib.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 46. 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:664:18)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/user/ml-interface/node_modules/bcrypt/bcrypt.js:6:16)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node bin/main.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2017-12-15T11_09_36_202Z-debug.log

I have tried doing a npm rebuild inside of bcrypt, as well as updating the binaries

> [email protected] install /home/nmordecai/ml-interface/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

[bcrypt] Success: "/home/nmordecai/ml-interface/node_modules/bcrypt/lib/binding/bcrypt_lib.node" is installed via remote
[email protected] /home/nmordecai/ml-interface/node_modules/bcrypt

Though it says it was successful, it is not.
npm version: 5.6.0
node version: 8.9.1
os: linux ubuntu 16.04.3 LTS

Most helpful comment

I fixed the issue by installing https://www.npmjs.com/package/bcryptjs it's the same as bcrypt, however it's already bundled with no dependencies, which fixed by issue. Hope this helps.

All 6 comments

I'm having the same issue. Any update on how to fix this?

I fixed the issue by installing https://www.npmjs.com/package/bcryptjs it's the same as bcrypt, however it's already bundled with no dependencies, which fixed by issue. Hope this helps.

That works perfectly. Thanks!

Glad I could help :)

I'm currently experiencing this issue. Switching to bcryptjs isn't an option because bcrypt is a dependency of one of my dependencies rather than a direct dependency.

I've tried deleting both node_modules and package-lock.json and running npm i multiple times. I've also tried npm rebuild and npm rebuild bcrypt --update-binary. I'm using node v9.2.0 (sudo node --version prints the same version).

This issue shouldn't have been closed considering the only "solution" was to just use a different
(but compatible) library.

Try npm rebuild bcrypt --build-from-source

npm rebuild should have downloaded the current version for you.

We are sorry that we don't have a better solution. NodeJS does not provide ABI compatibility reliably. So native modules and NodeJS ABIs must match. This involves rebuilding the module whenever the NodeJS version changes.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Z3roCoder picture Z3roCoder  路  5Comments

youngrrrr picture youngrrrr  路  5Comments

japita-se picture japita-se  路  4Comments

enneid picture enneid  路  5Comments

SpaceG picture SpaceG  路  4Comments