1安装版本管理工具git
yum install git
查看git版本
1 | git --version |
2 安装Node.js版本管理工具nvm
1 | curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash |
或者
1 | wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash |
还可以用下面这种方法
1 | git clone git://github.com/creationix/nvm.git ~/nvm |
设置nvm自动运行
1 2 | echo "source ~/nvm/nvm.sh" >> ~/.bashrc source ~/.bashrc |
查询Node.js版本
1 | nvm list-remote |
安装Node.js版本
1 | nvm install v8.6.0 |
切换Node.js版本
1 | nvm use v8.6.0 |
升级npm
1 | npm -g |