Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node - was compiled against a different Node.js version using NODE_MODULE_VERSION 51

People also ask

How do I change node js from one version to another?

Switching among Node. 7; we can simply run either nvm use 12.22. 7 or nvm use 16.13. 0 to easily switch into either version we need. Note that since we only have one version that begins with 12, 14, or 16, we can switch versions with a simple nvm use 16 , nvm use 14 , or nvm use 12 command.

How do I update NodeJs to version 16?

Just go to nodejs.org and use the latest installer. just downloaded newest version, install, went to command prompt typed node -v , saw change instantly.


You need to remove the module folder (bcrypt) from the node_modules folder and reinstall it, use the following commands:

$ rm -rf node_modules/bcrypt
$ npm install
// or
$ yarn

I had the same problem and nothing mentioned here worked for me. Here is what worked for me:

  1. Require all dependencies you need in the main.js file that is run by electron. (this seemed to be the first important part for me)
  2. Run npm i -D electron-rebuild to add the electron-rebuild package
  3. Remove the node-modules folder, as well as the packages-lock.json file.
  4. Run npm i to install all modules.
  5. Run ./node_modules/.bin/electron-rebuild (.\node_modules\.bin\electron-rebuild.cmd for Windows) to rebuild everything

It is very important to run ./node_modules/.bin/electron-rebuild directly after npm i otherwise it did not work on my mac.

I hope I could help some frustrated souls.


You have to rebuild the package and tell npm to update it's binary too. Try:

npm rebuild bcrypt --update-binary

@robertklep answered a relative question with this command, look.

Only rebuild haven't solved my problem, this works fine in my application.

Hope it helps!


Simply run:

npm uninstall bcrypt

Followed by:

npm install bcrypt (or npm install, if bcrypt is declared as dependency in your package.json file)