简体   繁体   English

nodejs 4.2.6未更新到最新版本

[英]nodejs 4.2.6 not getting updated to latest version

I installed Node and npm as they are required to install angular cli. 我安装了Node和npm,因为它们是安装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. 错误:已知npm不能在Node.js v4.2.6上运行,但支持Node.js 4,但是您正在运行的特定版本存在一个已知的错误,可能会破坏npm。 Please update to at least 4.7.0 to use this version of npm. 请至少更新到4.7.0才能使用此版本的npm。 You can find the latest release of Node.js at https://nodejs.org/ 您可以在https://nodejs.org/上找到最新版本的Node.js。

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. 我尝试按照我在Internet上找到的所有方式删除节点,npm,然后重新安装,更新节点,但是版本(4.2.6)仍然相同。

I don't understand what I am doing wrong as I am new to Linux. 我不了解我做错了什么,因为我是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. 出乎意料的是, npm在Linux中非常复杂,直到您发现Node Version Manager为止,该版本使您可以轻松安装新版本并在它们之间进行交换。

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> 安装nvm之后,可以使用nvm install <VERSION_NUMBER>安装任何节点版本,并且可以将其设置为default,并使用nvm alias default <VERSION_NUMBER>

You can swap between versions using nvm use <VERSION_NUMBER> 您可以使用nvm use <VERSION_NUMBER>在版本之间进行交换

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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