Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recompiling node dependencies using another node version

I want to install some dependencies and in this case installing node-pty. But when I run it they give me this error:

Error: The module '/home/dev/Documents/project/node_web_kit/node_modules/node-pty/build/Release/pty.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 46. This version of Node.js requires NODE_MODULE_VERSION 51. Please try re-compiling or re-installing

any solutions?

like image 985
Adi Sparta Avatar asked Apr 01 '17 15:04

Adi Sparta


People also ask

Can I use two node versions?

Multiple Node JS Versions with NVM. NVM (Node Version Manager) can also be used to manage multiple NodeJS versions at the same time. You can install setup NVM in your machine by running the following commands.

How do I switch between node versions?

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.

Is npm version tied to node version?

Node. js and NPM versions aren't directly connected, otherwise they would have matching versions. PATCH version when you make backwards-compatible bug fixes.


1 Answers

The simplest way to be sure is just to delete node_modules and re-run npm i from scratch, that way all modules will definitely be set up for the new Node version.

like image 195
Jason Livesay Avatar answered Sep 30 '22 21:09

Jason Livesay