How do I update Node.js?

2019-01-01 02:53发布

I did the following to update my 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.)

30条回答
孤独寂梦人
2楼-- · 2019-01-01 03:26

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

$ brew upgrade node
查看更多
梦该遗忘
3楼-- · 2019-01-01 03:26
查看更多
人气声优
4楼-- · 2019-01-01 03:26

All you need to version update of Node.js:

$ brew install node

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

查看更多
与君花间醉酒
5楼-- · 2019-01-01 03:27

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

These few lines will handle everything (for 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.

查看更多
刘海飞了
6楼-- · 2019-01-01 03:27

You may use nvm.

  1. Check what is the latest version at http://nodejs.org/ (e.g. v0.10.26)
  2. Run nvm install 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 use VERSION change the current node to the requested version.

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).

查看更多
皆成旧梦
7楼-- · 2019-01-01 03:28

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.

查看更多
登录 后发表回答