如何更新Node.js?

时间:2022-10-30 21:27:17

I did the following to update my npm:

我做了以下更新我的npm:

npm update npm -g

But I have no idea how to update Node.js. Any suggestions? (I'm using Node.js 0.4.1 and want to update to Node.js 0.6.1.)

但是我不知道如何更新Node.js。有什么建议吗?(我使用节点。js 0.4.1并希望更新到Node。js 0.6.1)。

28 个解决方案

#1


280  

Use Node Version Manager (NVM)

使用节点版本管理器(NVM)

It's a Bash script that lets you download and manage different versions of node. Full source code is here.

它是一个Bash脚本,允许您下载和管理不同版本的节点。完整的源代码在这里。

There is a separate project for nvm for Windows: github.com/coreybutler/nvm-windows

另外还有一个针对Windows的nvm项目:github.com/coreybutler/nvm-windows。

#2


797  

I used the following instructions to upgrade from Node.js version 0.10.6 to 0.10.21 on a Mac.

我使用下面的指令从节点升级。js版本0.10.6到0.10.21在Mac上。

  1. Clear NPM's cache:

    明确NPM的缓存:

    sudo npm cache clean -f
    
  2. Install a little helper called 'n'

    安装一个名为'n'的小助手

    sudo npm install -g n
    
  3. Install latest stable Node.js version

    安装最新稳定节点。js版本

    sudo n stable
    

Alternatively pick a specific version and install like this:

或者选择一个特定的版本并安装如下:

sudo n 0.8.20

For production environments you might want to pay attention to version numbering and be picky about odd/even numbers.

对于生产环境,您可能需要注意版本编号,并对奇数/偶数进行挑剔。

Credits

学分

  • General procedure: D.Walsh
  • 一般程序:D.Walsh
  • Stable/unstable versions: P.Teixeira
  • 稳定/不稳定版本:P.Teixeira

Update (June 2017):

更新(2017年6月):

This four years old post still receives up-votes so I'm guessing it still works for many people. However, Mr. Walsh himself recommended to update Node.js just using nvm instead.

这四年前的帖子仍然得到了支持,所以我猜它仍然适用于很多人。不过,沃尔什本人建议更新节点。js只是用了nvm。

So here's what you might want to do today:

下面是你今天可能想做的:

Find out which version of Node.js you are using:

找出哪个版本的节点。js使用:

node --version

Find out which versions of Node.js you may have installed and which one of those you're currently using:

找出哪个版本的节点。你可能已经安装了,并且你现在正在使用的其中一个:

nvm ls

List all versions of Node.js available for installation:

列出所有版本的节点。js可供安装:

nvm ls-remote

Apparently for Windows the command would be rather like this:

显然,Windows的命令是这样的:

nvm ls available

Assuming you would pick Node.js v8.1.0 for installation you'd type the following to install that version:

假设你选择了节点。js v8.1.0安装时需要输入以下版本:

nvm install 8.1.0

You are then free to choose between installed versions of Node.js. So if you would need to use an older version like v4.2.0 you would set it as the active version like this:

然后可以在安装的Node.js版本之间*选择。因此,如果你需要使用像v4.2.0这样的旧版本,你可以将它设置为像这样的活动版本:

nvm use 4.2

#3


264  

If you have Homebrew installed (only for OS X):

如果您已经安装了Homebrew(仅适用于OS X):

$ brew upgrade node

#4


148  

This is a simple solution that works for Windows, Linux, MacOS, and SunOS:

这是一个简单的解决方案,适用于Windows、Linux、MacOS和SunOS:

After a lot of surfing and not finding a straight solution, I just tried going to Node.js site, clicked the download button on homepage and executed the installer program (MSI).

在大量的冲浪和找不到一个直接的解决方案之后,我尝试去了Node。js站点,点击主页上的下载按钮,执行安装程序(MSI)。

Thankfully it took care of everything and with a few clicks of 'Next' button I got the latest Node.js version running on my Windows machine.

幸运的是,它处理了所有的事情,点击“Next”按钮,我得到了最新的节点。在我的Windows机器上运行js版本。

(here is original answer)

(这里是原始的回答)

PS: To check your Node version use npm version or node --version.
PPS: Keep an eye on NodeJS blog - Vulnerabilities so you don't miss important security releases.

检查您的节点版本使用npm版本或节点——版本。关注NodeJS博客-漏洞,这样你就不会错过重要的安全发布。

#5


132  

On Windows you can use Chocolatey to install and update Node.js (and lots of other packages).

在Windows上,您可以使用Chocolatey来安装和更新节点。js(还有很多其他的包)。

Install Node

安装节点

cinst nodejs.install

Update Node

更新节点

cup nodejs.install

Note: You will need to install Chocolatey before you can use cinst and cup.

注意:在使用cinst和cup之前,你需要安装Chocolatey。

#6


112  

All platforms (Windows, Mac & Linux)

Just go to nodejs.org and download the latest installer. It couldn't be any simpler honestly, and without involvement of any third-party stuff. It only takes a minute and does not require you to restart anything or clean out caches, etc.

去nodejs.org下载最新的安装程序。老实说,这是不可能的,而且没有第三方的参与。它只需要一分钟,不需要您重新启动任何东西或清理缓存,等等。

I've done it via npm a few times before and have run into a few issues. Like for example with the n-package not using the latest stable release.

我以前通过npm做过几次,遇到了一些问题。例如,使用n-package,而不是使用最新的稳定版本。

#7


73  

To control your version of Node.js, you can try n. I found it very straightforward and useful.

要控制您的节点版本。js,你可以试试n,我觉得它很简单,很有用。

n is a Node.js binary management, no subshells, no profile setup, no convoluted API, just simple.

n是一个节点。js二进制管理,没有子shell,没有配置文件设置,没有复杂的API,只是简单。

npm install -g n

n 0.6.19 will install Node.js v0.6.19.

将安装节点。js v0.6.19。

#8


35  

To upgrade node to the latest version or to a specific version you can do the following:

要将节点升级到最新版本或特定版本,您可以执行以下操作:

sudo npm install n -g
sudo n 0.10.18   // This will give you the specific version

For the latest stable version:

最新稳定版:

sudo n stable

#9


29  

I had the same problem, when I saw that my Node.js installation is outdated.

当我看到我的节点时,我遇到了同样的问题。js安装已经过时了。

These few lines will handle everything (for Ubuntu):

这几行代码将处理一切(对于Ubuntu):

sudo npm cache clean -f
sudo npm install -g n
sudo n stable

After this node -v will return you the latest available version.

在此节点-v之后,将返回最新的可用版本。

#10


29  

Short & stupid answer:

短的和愚蠢的回答:

Go to this page: Download | Node.js

请访问此页面:下载| Node.js。

Download the installer for your platform, then install it.

下载您的平台的安装程序,然后安装它。

#11


21  

First update npm,

第一个更新npm,

npm install -g npm stable

npm安装- gnpm稳定。

Then update node,

然后更新节点,

npm install -g node or npm install -g n

npm安装-g节点或npm安装-g n。

check after version installation,

检查版本安装后,

node --versionor node -v

节点——versionor节点- v

#12


16  

On CentOS 7 you can do the following:

在CentOS 7,你可以做如下:

sudo npm cache clean -f
sudo npm install -g n
sudo n stable
sudo ln -sf /usr/local/n/versions/node/5.4.1/bin/node /usr/bin/node
node –v (Should show updated version now)
npm rebuild node-sass (Optional: if you use this)

Note: The symlink is required to link your node binary with the latest Node.js installed binary file.

注意:需要将节点二进制文件与最新的节点链接在一起。js安装二进制文件。

#13


10  

For OS X, I had v5.4.1 and needed the latest version 6 so I went to the Node.js homepage and clicked on one of the links below:

对于OS X,我有v5.4.1,需要最新的版本6,所以我去了节点。js主页点击下面的链接:

如何更新Node.js?

I then followed the installer and then I magically had the latest version of Node.js and npm.

然后我跟踪安装程序,然后神奇地拥有了最新版本的节点。js和npm。

#14


4  

Some Linux distributions such as Arch Linux have Node.js in their package repositories. On such systems it is better to use a standard package update procedure, such as pacman -Suy or analogous apt-get or yum commands.

一些Linux发行版,如Arch Linux有节点。js在他们的包存储库中。在这样的系统中,最好使用标准的包更新程序,比如pacman -Suy或类似的apt-get或yum命令。

As of now (Nov 2016) EPEL7 offers a pretty recent version of Node.js (6.9.1 which is an up-to-date LTS version offered on the Node.js home page). So on CentOS 7 and derivatives you can just add EPEL repository by yum install epel-release and yum install nodejs.

截至目前(2016年11月),EPEL7提供了一个最近版本的节点。js(6.9.1是在节点上提供的最新LTS版本)。js主页)。因此,在CentOS 7和衍生品上,你可以通过yum安装EPEL发布和yum安装nodejs来添加EPEL存储库。

CentOS 6/EPEL6 has 0.10.x which isn't supported upstream since Oct 2016.

6 / EPEL6 CentOS 0.10。x从2016年10月开始不支持上游业务。

#15


3  

You may use nvm.

你可以用nvm。

  1. Check what is the latest version at http://nodejs.org/ (e.g. v0.10.26)
  2. 请查看http://nodejs.org/(例如v0.10.26)的最新版本。
  3. Run nvm install v0.10.26
  4. 运行nvm安装v0.10.26

Done.

完成了。

You can choose which version to run:

您可以选择运行哪个版本:

nvm ls list the available versions and tells you which version you are using now.

nvm ls列出了可用的版本,并告诉您现在正在使用的版本。

nvm use VERSION change the current node to the requested version.

nvm使用版本将当前节点更改为所请求的版本。

nvm alias default VERSION set the default version. The next time you source nvm.sh, this will be the version loaded (note that it doesn't change the version in use right now, run nvm use for that).

nvm别名默认版本设置默认版本。下次你再找nvm的时候。sh,这将是加载的版本(注意,它不会改变现在使用的版本,运行nvm使用)。

#16


3  

$ npm install -g npm stable

worked for me to update npm

为我工作,更新npm。

#17


2  

You may use Chocolatey on Windows. It's very easy to use and useful for keeping you updated with other applications too.

你可以在窗户上使用巧克力。它很容易使用,并且可以帮助您更新其他应用程序。

Also, you can just simply download the latest version from https://nodejs.org and install it.

另外,您可以简单地从https://nodejs.org下载最新版本并安装它。

#18


2  

  • Install nvm(cURL)

    安装nvm(卷)

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

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

    OR with Wget

    与Wget或

    $ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash

    $ wget - qo - https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh| bash。

  • Display list of installed versions

    显示已安装版本列表。

    $ nvm ls

    美元nvm ls

  • Display list of versions that are available to install

    显示可供安装的版本列表。

    $ nvm ls-remote

    美元nvm ls-remote

  • Install your preferred version

    安装您的首选版本

    $ nvm install v7.5.0

    美元nvm安装v7.5.0

  • Set this version as the default

    将此版本设置为默认值。

    $ nvm alias default v7.5.0

    $ nvm别名默认v7.5.0。

#19


2  

chocolately was alredy installed on my windows

我的窗户上安装了巧克力。

i followed rob's answer

我跟着罗伯的答案

cinst nodejs.install

cinst nodejs.install

after a few minutes latest node is installed

在几分钟后,安装了最新的节点。

如何更新Node.js?

#20


1  

For Ubuntu:

Ubuntu的:

sudo apt-get install -y curl
curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
sudo apt-get install -y nodejs

Source: https://askubuntu.com/questions/426750/how-can-i-update-my-nodejs-to-the-latest-version

来源:https://askubuntu.com/questions/426750/how-can-i-update-my-nodejs-to-the-latest-version

#21


1  

As some of you already said, the easiest way is to update Node.js through the Node.js package manager, npm. If you are a Linux (Debian-based in my case) user I would suggest to add these lines to your .bashrc file (in home directory):

正如你们有些人已经说过的,最简单的方法是更新节点。js通过节点。js包管理器npm。如果您是一个Linux(基于我的例子)用户,我建议将这些行添加到您的.bashrc文件(在主目录中):

function nodejsupdate() {
    ARGC=$#
    version=latest
    if [ $ARGC != 0 ]; then
        version=$1
    fi
    sudo npm cache clean -f
    sudo npm install -g n
    sudo n $version
}

Restart your terminal after saving and write nodejsupdate to update to the latest version of Node.js or nodejsupdate v6.0.0 (for example) to update to a specific version of Node.js.

在保存并写入nodejsupdate以更新到最新版本的节点后,重新启动您的终端。js或nodejsupdate v6.0.0(例如)更新到特定版本的Node.js。

BONUS: Update npm (add these lines to .bashrc)

奖励:更新npm(将这些行添加到.bashrc)

function npmupdate() {
    sudo npm i npm -g
}

After restarting the terminal write npmupdate to update your node package manager to the latest version.

重新启动终端后,npmupdate将更新您的节点包管理器到最新版本。

Now you can update Node.js and npm through your terminal (easier).

现在可以更新节点了。js和npm通过你的终端(更容易)。

#22


1  

All you need to version update of Node.js:

所有您需要的版本更新的Node.js:

$ brew install node

If you don't have Homebrew; please go http://brew.sh/.

如果你没有家酿啤酒;请访问http://brew.sh/。

#23


1  

The easy way to update node and npm :

更新节点和npm的简单方法:

npm install -g npm@latest

download the latest version of node js and update /install

下载最新版本的node js并更新/安装。

#24


0  

Just install the new version over the current folder. I upgraded mine from v4.x to v6.10 on Windows.

只需在当前文件夹上安装新版本。我从v4升级了我的。在Windows上的x到v6.10。

#25


0  

According to Nodejs Official Page, you can install&update new node version on windows using Chocolatey or Scoop

根据Nodejs的官方页面,你可以使用巧克力或勺子在windows上安装和更新新的节点版本。

Using(Chocolatey):

使用(巧克力色):

cinst nodejs
# or for full install with npm
cinst nodejs.install

Using(Scoop):

使用(独家):

scoop install nodejs

Also you can download the Windows Installer directly from the nodejs.org web site

也可以直接从nodejs.org网站下载Windows安装程序。

#26


0  

In windows download the node executable file from the website and install it. this worked for me.

在windows下载节点可执行文件从网站并安装它。这为我工作。

#27


-3  

  1. npm clean cache - you forget to clean ur cache
  2. npm干净的缓存-你忘记清理你的缓存。
  3. npm update -g

    npm更新- g

    This works on mine Windows, I hope it will also work for you :D

    这是我的窗户,我希望它也能为你工作:D。

#28


-3  

If you want to update Node.js, just try

如果您想要更新节点。js,试试

npm update

from your Windows cmd prompt.

从您的Windows cmd提示符。

Else if you want to update any specific package try

如果您想要更新任何特定的包,请尝试。

npm update <package_name>

Example:

例子:

npm update phonegap

#1


280  

Use Node Version Manager (NVM)

使用节点版本管理器(NVM)

It's a Bash script that lets you download and manage different versions of node. Full source code is here.

它是一个Bash脚本,允许您下载和管理不同版本的节点。完整的源代码在这里。

There is a separate project for nvm for Windows: github.com/coreybutler/nvm-windows

另外还有一个针对Windows的nvm项目:github.com/coreybutler/nvm-windows。

#2


797  

I used the following instructions to upgrade from Node.js version 0.10.6 to 0.10.21 on a Mac.

我使用下面的指令从节点升级。js版本0.10.6到0.10.21在Mac上。

  1. Clear NPM's cache:

    明确NPM的缓存:

    sudo npm cache clean -f
    
  2. Install a little helper called 'n'

    安装一个名为'n'的小助手

    sudo npm install -g n
    
  3. Install latest stable Node.js version

    安装最新稳定节点。js版本

    sudo n stable
    

Alternatively pick a specific version and install like this:

或者选择一个特定的版本并安装如下:

sudo n 0.8.20

For production environments you might want to pay attention to version numbering and be picky about odd/even numbers.

对于生产环境,您可能需要注意版本编号,并对奇数/偶数进行挑剔。

Credits

学分

  • General procedure: D.Walsh
  • 一般程序:D.Walsh
  • Stable/unstable versions: P.Teixeira
  • 稳定/不稳定版本:P.Teixeira

Update (June 2017):

更新(2017年6月):

This four years old post still receives up-votes so I'm guessing it still works for many people. However, Mr. Walsh himself recommended to update Node.js just using nvm instead.

这四年前的帖子仍然得到了支持,所以我猜它仍然适用于很多人。不过,沃尔什本人建议更新节点。js只是用了nvm。

So here's what you might want to do today:

下面是你今天可能想做的:

Find out which version of Node.js you are using:

找出哪个版本的节点。js使用:

node --version

Find out which versions of Node.js you may have installed and which one of those you're currently using:

找出哪个版本的节点。你可能已经安装了,并且你现在正在使用的其中一个:

nvm ls

List all versions of Node.js available for installation:

列出所有版本的节点。js可供安装:

nvm ls-remote

Apparently for Windows the command would be rather like this:

显然,Windows的命令是这样的:

nvm ls available

Assuming you would pick Node.js v8.1.0 for installation you'd type the following to install that version:

假设你选择了节点。js v8.1.0安装时需要输入以下版本:

nvm install 8.1.0

You are then free to choose between installed versions of Node.js. So if you would need to use an older version like v4.2.0 you would set it as the active version like this:

然后可以在安装的Node.js版本之间*选择。因此,如果你需要使用像v4.2.0这样的旧版本,你可以将它设置为像这样的活动版本:

nvm use 4.2

#3


264  

If you have Homebrew installed (only for OS X):

如果您已经安装了Homebrew(仅适用于OS X):

$ brew upgrade node

#4


148  

This is a simple solution that works for Windows, Linux, MacOS, and SunOS:

这是一个简单的解决方案,适用于Windows、Linux、MacOS和SunOS:

After a lot of surfing and not finding a straight solution, I just tried going to Node.js site, clicked the download button on homepage and executed the installer program (MSI).

在大量的冲浪和找不到一个直接的解决方案之后,我尝试去了Node。js站点,点击主页上的下载按钮,执行安装程序(MSI)。

Thankfully it took care of everything and with a few clicks of 'Next' button I got the latest Node.js version running on my Windows machine.

幸运的是,它处理了所有的事情,点击“Next”按钮,我得到了最新的节点。在我的Windows机器上运行js版本。

(here is original answer)

(这里是原始的回答)

PS: To check your Node version use npm version or node --version.
PPS: Keep an eye on NodeJS blog - Vulnerabilities so you don't miss important security releases.

检查您的节点版本使用npm版本或节点——版本。关注NodeJS博客-漏洞,这样你就不会错过重要的安全发布。

#5


132  

On Windows you can use Chocolatey to install and update Node.js (and lots of other packages).

在Windows上,您可以使用Chocolatey来安装和更新节点。js(还有很多其他的包)。

Install Node

安装节点

cinst nodejs.install

Update Node

更新节点

cup nodejs.install

Note: You will need to install Chocolatey before you can use cinst and cup.

注意:在使用cinst和cup之前,你需要安装Chocolatey。

#6


112  

All platforms (Windows, Mac & Linux)

Just go to nodejs.org and download the latest installer. It couldn't be any simpler honestly, and without involvement of any third-party stuff. It only takes a minute and does not require you to restart anything or clean out caches, etc.

去nodejs.org下载最新的安装程序。老实说,这是不可能的,而且没有第三方的参与。它只需要一分钟,不需要您重新启动任何东西或清理缓存,等等。

I've done it via npm a few times before and have run into a few issues. Like for example with the n-package not using the latest stable release.

我以前通过npm做过几次,遇到了一些问题。例如,使用n-package,而不是使用最新的稳定版本。

#7


73  

To control your version of Node.js, you can try n. I found it very straightforward and useful.

要控制您的节点版本。js,你可以试试n,我觉得它很简单,很有用。

n is a Node.js binary management, no subshells, no profile setup, no convoluted API, just simple.

n是一个节点。js二进制管理,没有子shell,没有配置文件设置,没有复杂的API,只是简单。

npm install -g n

n 0.6.19 will install Node.js v0.6.19.

将安装节点。js v0.6.19。

#8


35  

To upgrade node to the latest version or to a specific version you can do the following:

要将节点升级到最新版本或特定版本,您可以执行以下操作:

sudo npm install n -g
sudo n 0.10.18   // This will give you the specific version

For the latest stable version:

最新稳定版:

sudo n stable

#9


29  

I had the same problem, when I saw that my Node.js installation is outdated.

当我看到我的节点时,我遇到了同样的问题。js安装已经过时了。

These few lines will handle everything (for Ubuntu):

这几行代码将处理一切(对于Ubuntu):

sudo npm cache clean -f
sudo npm install -g n
sudo n stable

After this node -v will return you the latest available version.

在此节点-v之后,将返回最新的可用版本。

#10


29  

Short & stupid answer:

短的和愚蠢的回答:

Go to this page: Download | Node.js

请访问此页面:下载| Node.js。

Download the installer for your platform, then install it.

下载您的平台的安装程序,然后安装它。

#11


21  

First update npm,

第一个更新npm,

npm install -g npm stable

npm安装- gnpm稳定。

Then update node,

然后更新节点,

npm install -g node or npm install -g n

npm安装-g节点或npm安装-g n。

check after version installation,

检查版本安装后,

node --versionor node -v

节点——versionor节点- v

#12


16  

On CentOS 7 you can do the following:

在CentOS 7,你可以做如下:

sudo npm cache clean -f
sudo npm install -g n
sudo n stable
sudo ln -sf /usr/local/n/versions/node/5.4.1/bin/node /usr/bin/node
node –v (Should show updated version now)
npm rebuild node-sass (Optional: if you use this)

Note: The symlink is required to link your node binary with the latest Node.js installed binary file.

注意:需要将节点二进制文件与最新的节点链接在一起。js安装二进制文件。

#13


10  

For OS X, I had v5.4.1 and needed the latest version 6 so I went to the Node.js homepage and clicked on one of the links below:

对于OS X,我有v5.4.1,需要最新的版本6,所以我去了节点。js主页点击下面的链接:

如何更新Node.js?

I then followed the installer and then I magically had the latest version of Node.js and npm.

然后我跟踪安装程序,然后神奇地拥有了最新版本的节点。js和npm。

#14


4  

Some Linux distributions such as Arch Linux have Node.js in their package repositories. On such systems it is better to use a standard package update procedure, such as pacman -Suy or analogous apt-get or yum commands.

一些Linux发行版,如Arch Linux有节点。js在他们的包存储库中。在这样的系统中,最好使用标准的包更新程序,比如pacman -Suy或类似的apt-get或yum命令。

As of now (Nov 2016) EPEL7 offers a pretty recent version of Node.js (6.9.1 which is an up-to-date LTS version offered on the Node.js home page). So on CentOS 7 and derivatives you can just add EPEL repository by yum install epel-release and yum install nodejs.

截至目前(2016年11月),EPEL7提供了一个最近版本的节点。js(6.9.1是在节点上提供的最新LTS版本)。js主页)。因此,在CentOS 7和衍生品上,你可以通过yum安装EPEL发布和yum安装nodejs来添加EPEL存储库。

CentOS 6/EPEL6 has 0.10.x which isn't supported upstream since Oct 2016.

6 / EPEL6 CentOS 0.10。x从2016年10月开始不支持上游业务。

#15


3  

You may use nvm.

你可以用nvm。

  1. Check what is the latest version at http://nodejs.org/ (e.g. v0.10.26)
  2. 请查看http://nodejs.org/(例如v0.10.26)的最新版本。
  3. Run nvm install v0.10.26
  4. 运行nvm安装v0.10.26

Done.

完成了。

You can choose which version to run:

您可以选择运行哪个版本:

nvm ls list the available versions and tells you which version you are using now.

nvm ls列出了可用的版本,并告诉您现在正在使用的版本。

nvm use VERSION change the current node to the requested version.

nvm使用版本将当前节点更改为所请求的版本。

nvm alias default VERSION set the default version. The next time you source nvm.sh, this will be the version loaded (note that it doesn't change the version in use right now, run nvm use for that).

nvm别名默认版本设置默认版本。下次你再找nvm的时候。sh,这将是加载的版本(注意,它不会改变现在使用的版本,运行nvm使用)。

#16


3  

$ npm install -g npm stable

worked for me to update npm

为我工作,更新npm。

#17


2  

You may use Chocolatey on Windows. It's very easy to use and useful for keeping you updated with other applications too.

你可以在窗户上使用巧克力。它很容易使用,并且可以帮助您更新其他应用程序。

Also, you can just simply download the latest version from https://nodejs.org and install it.

另外,您可以简单地从https://nodejs.org下载最新版本并安装它。

#18


2  

  • Install nvm(cURL)

    安装nvm(卷)

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

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

    OR with Wget

    与Wget或

    $ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash

    $ wget - qo - https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh| bash。

  • Display list of installed versions

    显示已安装版本列表。

    $ nvm ls

    美元nvm ls

  • Display list of versions that are available to install

    显示可供安装的版本列表。

    $ nvm ls-remote

    美元nvm ls-remote

  • Install your preferred version

    安装您的首选版本

    $ nvm install v7.5.0

    美元nvm安装v7.5.0

  • Set this version as the default

    将此版本设置为默认值。

    $ nvm alias default v7.5.0

    $ nvm别名默认v7.5.0。

#19


2  

chocolately was alredy installed on my windows

我的窗户上安装了巧克力。

i followed rob's answer

我跟着罗伯的答案

cinst nodejs.install

cinst nodejs.install

after a few minutes latest node is installed

在几分钟后,安装了最新的节点。

如何更新Node.js?

#20


1  

For Ubuntu:

Ubuntu的:

sudo apt-get install -y curl
curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
sudo apt-get install -y nodejs

Source: https://askubuntu.com/questions/426750/how-can-i-update-my-nodejs-to-the-latest-version

来源:https://askubuntu.com/questions/426750/how-can-i-update-my-nodejs-to-the-latest-version

#21


1  

As some of you already said, the easiest way is to update Node.js through the Node.js package manager, npm. If you are a Linux (Debian-based in my case) user I would suggest to add these lines to your .bashrc file (in home directory):

正如你们有些人已经说过的,最简单的方法是更新节点。js通过节点。js包管理器npm。如果您是一个Linux(基于我的例子)用户,我建议将这些行添加到您的.bashrc文件(在主目录中):

function nodejsupdate() {
    ARGC=$#
    version=latest
    if [ $ARGC != 0 ]; then
        version=$1
    fi
    sudo npm cache clean -f
    sudo npm install -g n
    sudo n $version
}

Restart your terminal after saving and write nodejsupdate to update to the latest version of Node.js or nodejsupdate v6.0.0 (for example) to update to a specific version of Node.js.

在保存并写入nodejsupdate以更新到最新版本的节点后,重新启动您的终端。js或nodejsupdate v6.0.0(例如)更新到特定版本的Node.js。

BONUS: Update npm (add these lines to .bashrc)

奖励:更新npm(将这些行添加到.bashrc)

function npmupdate() {
    sudo npm i npm -g
}

After restarting the terminal write npmupdate to update your node package manager to the latest version.

重新启动终端后,npmupdate将更新您的节点包管理器到最新版本。

Now you can update Node.js and npm through your terminal (easier).

现在可以更新节点了。js和npm通过你的终端(更容易)。

#22


1  

All you need to version update of Node.js:

所有您需要的版本更新的Node.js:

$ brew install node

If you don't have Homebrew; please go http://brew.sh/.

如果你没有家酿啤酒;请访问http://brew.sh/。

#23


1  

The easy way to update node and npm :

更新节点和npm的简单方法:

npm install -g npm@latest

download the latest version of node js and update /install

下载最新版本的node js并更新/安装。

#24


0  

Just install the new version over the current folder. I upgraded mine from v4.x to v6.10 on Windows.

只需在当前文件夹上安装新版本。我从v4升级了我的。在Windows上的x到v6.10。

#25


0  

According to Nodejs Official Page, you can install&update new node version on windows using Chocolatey or Scoop

根据Nodejs的官方页面,你可以使用巧克力或勺子在windows上安装和更新新的节点版本。

Using(Chocolatey):

使用(巧克力色):

cinst nodejs
# or for full install with npm
cinst nodejs.install

Using(Scoop):

使用(独家):

scoop install nodejs

Also you can download the Windows Installer directly from the nodejs.org web site

也可以直接从nodejs.org网站下载Windows安装程序。

#26


0  

In windows download the node executable file from the website and install it. this worked for me.

在windows下载节点可执行文件从网站并安装它。这为我工作。

#27


-3  

  1. npm clean cache - you forget to clean ur cache
  2. npm干净的缓存-你忘记清理你的缓存。
  3. npm update -g

    npm更新- g

    This works on mine Windows, I hope it will also work for you :D

    这是我的窗户,我希望它也能为你工作:D。

#28


-3  

If you want to update Node.js, just try

如果您想要更新节点。js,试试

npm update

from your Windows cmd prompt.

从您的Windows cmd提示符。

Else if you want to update any specific package try

如果您想要更新任何特定的包,请尝试。

npm update <package_name>

Example:

例子:

npm update phonegap