npm 升级node.js
This method of upgrading node is now unstable and should not be used. The best way to manage Node.js versions is to use NVM: Node Version Management.!
现在,这种升级节点的方法不稳定,不应该使用。 管理Node.js版本的最佳方法是使用NVM:节点版本管理。 !
I was recently installing a utility via NPM when I learned that my version of Node.js itself was out of date. No worries -- simply upgrade my Node.js install and move forward. Of course I could just hit nodejs.org and get the new image, but figured there had to be an easier way. It turns out there is -- you can upgrade your local Node.js with NPM:
当我得知我的Node.js版本本身已过时时,我最近通过NPM安装了一个实用程序。 不用担心-只需升级我的Node.js安装并继续前进。 当然,我可以单击nodejs.org并获取新图像,但认为必须有一种更简单的方法。 事实证明,您可以使用NPM升级本地Node.js :
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
The n package represents a Node helper, and running the last command upgrades node to the latest stable version. Instead of using "stable", you could specify a desired version:
n软件包表示节点帮助程序,运行最后一个命令会将节点升级到最新的稳定版本。 您可以指定所需的版本,而不是使用“稳定”版本:
sudo n 0.8.21
Once your install is complete, you can confirm you version with another command:
安装完成后,可以使用另一个命令确认版本:
node -v
It's quite nice that you can upgrade Node.js right from npm; it's like Inception...or something.
您可以直接从npm升级Node.js真是太好了。 就像《盗梦空间》之类的。
npm 升级node.js