简体   繁体   中英

nodejs 4.2.6 not getting updated to latest version

I installed Node and npm as they are required to install angular cli.
Now, if I type this command:

npm install -g angular-cli

I get this message in terminal:

ERROR: npm is known not to run on Node.js v4.2.6 Node.js 4 is supported but the specific version you're running has a bug known to break npm. Please update to at least 4.7.0 to use this version of npm. You can find the latest release of Node.js at https://nodejs.org/

I also followed this link, but still the issue is not resolved.

I tried removing node, npm and then reinstalling, updating node according to all the ways I found on internet, but still the version(4.2.6) is same.

I don't understand what I am doing wrong as I am new to Linux.

Surprisingly, npm is quite complicated in Linux, until you discover Node Version Manager which allows you to easily install new versions and swap between them.

After installing nvm, you can install any node version with nvm install <VERSION_NUMBER> and you can set it as default with nvm alias default <VERSION_NUMBER>

You can swap between versions using nvm use <VERSION_NUMBER>

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