1.使用nvm管理node,安装和更新nvm可以使用CURL
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
或者使用Wget:
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
2.设置环境变量
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
3.下载安装node:
nvm install node
- 切换版本:
nvm use node
Or
nvm run node --version
或者:
nvm exec 8.9 node --version
5.查看安装路径:
nvm which 8.9
详细说明传送门:
https://github.com/creationix/nvm
网友评论