nvm 安装node.js_使用nvm管理Node.js版本

nvm 安装node.js

A while back I wrote a blog post called Upgrade Node.js with NPM.  The shell commands within that post work great but there were reports in the comments that it could mess with node module paths and such -- a far from ideal situation.  Little did I know that I was only off by one letter:  nvm is the ideal solution.

前一段时间,我写了一篇博客文章NPM升级Node.js。 那篇文章中的shell命令很好用,但是注释中有报告说,它可能会弄乱节点模块路径,这很不理想。 我几乎不知道我只差一个字母:n v m是理想的解决方案。

安装 (Installation)

You can read the installation steps on the nvm GitHub page.  There are only two easy steps for installation and configuration.

您可以在nvm GitHub页面上阅读安装步骤。 安装和配置只有两个简单的步骤。

使用nvm (Using nvm)

If you work with a lot of different Node.js utilities, you know that sometimes you need to quickly switch to other versions of Node.js without hosing your entire machine.  That's where you can use nvm to download, install, and use different versions of Node.js:

如果您使用许多不同的Node.js实用程序,那么您就会知道有时您需要快速切换到其他版本的Node.js,而不必占用整个计算机。 您可以在此处使用nvm下载,安装和使用不同版本的Node.js:


nvm install 4.0


At any given time you can switch to another with use:

在任何时候,您可以切换到另一个use


nvm use 0.12


If you want to check out what versions of Node.js are installed on your machine, you can use the ls option:

如果要检查计算机上安装了哪个版本的Node.js,可以使用ls选项:


nvm ls

/*
		v0.10.26
		v0.10.36
->      v0.12.7
		v4.2.1
		system
*/


If you're done with a version and want it gone, you can do that too:

如果您已完成某个版本并希望它消失,您也可以这样做:


nvm uninstall 0.10


设置默认节点版本 (Set the Default Node Version)

You can set the default Node.js version by using alias:

您可以使用alias设置默认的Node.js版本:


nvm alias default system

# or...
nvm alias default v9.3.0



nvm has been a lifesaver for me, especially when troubleshooting issues in projects where the user may have more than one Node.js version.  If you're looking to get into Node.js development, one of the first tools you get should be nvm!

nvm对我来说是一个救命稻草,尤其是在对用户可能具有多个Node.js版本的项目中的问题进行故障排除时。 如果您打算进入Node.js开发,则首先获得的工具之一应该是nvm!

翻译自: https://davidwalsh.name/nvm

nvm 安装node.js

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值