I upgrade my node version from v7.1.0 to v9.4.0. After this m trying to run my server then I get this.
was compiled against a different Node.js version using
NODE_MODULE_VERSION 51. This version of Node.js requires
NODE_MODULE_VERSION 59. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
then I know about npm rebuild
. I run both command npm rebuild
and npm install
. It fixed after run npm rebuild
but I do not understand what it does.
Please explain about npm rebuild
thank you
The npm-rebuild command will run npm build command on the matched folders. This command is particularly useful when you install a new version of node, and you have to recompile all your C++ addons with the new binary. This command opens a package repository page in the browser.
npm install , or npm i , is used to install dependencies: It will install all the dependencies. If you use ^ or ~ when you specify the version of your dependency, npm may not install the exact version you specified. npm install can update your package-lock.
npm install installs dependencies into the node_modules/ directory, for the node project you're working on. You can call install on another node. js project (module), to install it as a dependency for your project. npm run build does nothing unless you specify what "build" does in your package.
The npm install installs all modules that are listed on package. json file and their dependencies. npm update updates all packages in the node_modules directory and their dependencies.
npm install: It is obvious that npm install
is used to install packages using the package.json
file, this command also installs the other packages on which the packages (in package.json
) are dependent. On the backside, this command uses the npm build
which helps to build the packages you are installing.
npm rebuild: As the name rebuild, this command again builds the packages, used only when you upgrade the node version and must recompile all your C++ addons with the new binary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With