Skip to content
On this page

学习记录

NVM是什么?

Node Version Manager(node 版本管理工具) 在日常开发中经常会遇到这种情况:手上有好几个项目,每个项目的需求不同,进而不同项目必须依赖不同版的 NodeJS 运行环境。为了更好的管理Node版本,就非常推荐使用nvm来进行管理。

NVM相关命令

nvm ls //查看node可用版本
nvm ls-remote //查看远端node可用版本
nvm install 16.14.0 //安装指定版本Node
nvm use 16.14.0 //切换使用指定版本
nvm run default --version //设置node 默认版本

安装使用

-- method1:
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash (适合linux&mac)
source ~/.bashrc
-- method2:
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash (适合linux)
source ~/.profile

链接

https://github.com/nvm-sh/nvm/releases/tag/v0.39.3