Nodejs管理工具Nvm安装过程详解

nvm

nvm负责管理多个版本的nodejs

安装:

https://github.com/coreybutler/nvm-windows/releases

下载nvm-setup.zip,nvm-noinstall.zip

87ADB6A7-7E97-0323-0D28-0AD38F81364E.png

点击nvm-setup.exe安装,一路下一步,这里安装到C:\dev\nvm,安装完成后自动配置了环境变量:NVM_HOME,NVM_SYMLINK,也会添加到Path

D51C29B6-0CEC-4D73-7078-C7C7F35B16C6.png

B67CA910-E774-AA61-EED5-AC09CF65759D.png

验证是否安装成功,打开命令行cmd

2CBE624C-ABDA-DA2D-8EBF-6631965A446B.png

nvm常用的命令
  • nvm list 查看当前安装的Node.js所有版本号
  • nvm install 版本号 安装指定版本的Node.js
  • nvm uninstall 版本号 卸载指定版本的Node.js
  • nvm use 版本号 选择指定版本的Node.js
命令案例操作
# 安装7.10.0版本
C:\Users\vagrant>nvm install 7.10.0
Downloading node.js version 7.10.0 (64-bit)...
Complete
Creating C:\dev\nvm\temp
Downloading npm version 4.2.0... Complete
Installing npm v4.2.0...
Installation complete. If you want to use this version, type
nvm use 7.10.0
# 安装6.10.3版本
C:\Users\vagrant>nvm install 6.10.3
Downloading node.js version 6.10.3 (64-bit)...
Complete
Creating C:\dev\nvm\temp
Downloading npm version 3.10.10... Complete
Installing npm v3.10.10...
Installation complete. If you want to use this version, type
nvm use 6.10.3
# 显示当前已经安装的版本
C:\Users\vagrant>nvm list
    7.10.0
    6.10.3
C:\Users\vagrant>
# 切换到7.10.0版本
C:\Users\vagrant>nvm  use 7.10.0
Now using node v7.10.0 (64-bit)
C:\Users\vagrant>nvm list
  * 7.10.0 (Currently using 64-bit executable)
6.10.3
# 查看当前使用的nodejs版本
C:\Users\vagrant>node -v
v7.10.0
# 切换版本
C:\Users\vagrant>nvm use 6.10.3
Now using node v6.10.3 (64-bit)
C:\Users\vagrant>nvm list
    7.10.0
  * 6.10.3 (Currently using 64-bit executable)
切换版本本质是是切换快捷方式

30AD4635-6956-696F-6586-408EA5DC12A9.png

收藏 (0)
评论列表
正在载入评论列表...
我是有底线的