简体   繁体   中英

npm is not compatible with Node.js

I had node installed in my machine and everything was working fine. During an online course made in 2019, the instructor was using an earlier version of npm (v5.5.1) and advised everyone to use the same version with him for follow up reasons. So I downgraded to v5.5.1 but now I keep getting one same error (incompatibility) for almost all commands. I read some solutions to similar problems here and even tried extra steps but the problem still persists. I uninstalled node from my system, restarted the system and reinstalled node but the version of npm still remained v5.5.1 . I tried to uninstall npm from the command line npm uninstall -g npm but it threw incompatibility error. I searched the web for compatible version of node.js for npm v5.5.1 and got node v10.15.1 which I downloaded installed with several system restarts but my node and npm still remain incompatible. Please what can I do?

You should use nvm which is the Node Version Manager , cURL:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash

commands:

nvm install <version>       Download and install a <version>
nvm use <version>           Modify PATH to use <version>
nvm ls                      List versions (installed versions are blue)

Helpful reads:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM