2

I updated my node version from 10.16.3 to 12.14.0. 3 months ago, I made api by using node js. At that time, it worked well. But now it throws errors.

These are what I did and errors.

D:\Projects\Project\Mean & Mern\Angular\data\API>node server
internal/modules/cjs/loader.js:1025
return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: The module '\\?\D:\Projects\Project\Mean & Mern\Angular\data\API\node_modules\bcrypt\lib\binding\bcrypt_lib.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 64. This version of Node.js requires
NODE_MODULE_VERSION 72. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1025:18)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Module.require (internal/modules/cjs/loader.js:852:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (D:\Projects\Project\Mean & Mern\Angular\data\API\node_modules\bcrypt\bcrypt.js:6:16)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)

I refer to this url: Node - was compiled against a different Node.js version using NODE_MODULE_VERSION 51

But nothing helps me. Please help me

Andronicus
  • 25,419
  • 17
  • 47
  • 88
Piece
  • 708
  • 13
  • 15

3 Answers3

5

I have found is to just use the nodejs.org site

1. go to https://nodejs.org/en/download/releases/

2. find version you want and click download

3. click the .pkg executable and follow the installation instructions

One way is to use NVM, the Node Version Manager.

You can find it at https://github.com/creationix/nvm

It allows you to easily install and manage multiple versions of node. Here's a snippet from the help:

Usage:
nvm install <version>       Download and install a <version>
nvm use <version>           Modify PATH to use <version>
nvm ls                      List versions (installed versions are blue)
Mitesh Sathavara
  • 429
  • 3
  • 11
2

You can use nvm to select your preferred node version with ease. Check this repo for details: https://github.com/nvm-sh/nvm

Shahed Mehbub
  • 551
  • 1
  • 3
  • 7
0

I found it!

Before I did do like this.

npm install
node server

But I couldn't run it. I try many times to fix, and finally I found this!

npm install canvas or yarn add canvas

And now it works! :D

Piece
  • 708
  • 13
  • 15