cd /usr/local wget https://registry.npmmirror.com/-/binary/node/latest-v12.x/node-v12.22.9-linux-x64.tar.gz tar -xvf node-v12.22.9-linux-x64.tar.gz cd node-v12.22.9-linux-x64/bin ./node -v ln -s /usr/local/node-v12.22.9-linux-x64/bin/node /usr/bin/node ln -s /usr/local/node-v12.22.9-linux-x64/bin/npm /usr/bin/npm
1.2.node14安装
1 2 3 4 5 6
https://registry.npmmirror.com/-/binary/node/latest-v14.x/node-v14.21.3-linux-x64.tar.gz tar -zxvf node-v14.21.3-linux-x64.tar.gz cd /usr/local/node-v14.21.3-linux-x64/bin ./node -v ln -s /usr/local/node-v14.21.3-linux-x64/bin/node /usr/bin/node ln -s /usr/local/node-v14.21.3-linux-x64/bin/npm /usr/bin/npm
1.3.node16安装
1 2 3 4 5 6
https://registry.npmmirror.com/-/binary/node/latest-v16.x/node-v16.20.0-linux-x64.tar.gz tar -zxvf node-v16.20.0-linux-x64.tar.gz cd /usr/local/node-v16.20.0-linux-x64/bin ./node -v ln -s /usr/local/node-v16.20.0-linux-x64/bin/node /usr/bin/node ln -s /usr/local/node-v16.20.0-linux-x64/bin/npm /usr/bin/npm
2.源码安装
说明:不推荐此方式,耗时、可能编译错误、依赖缺失。
1 2 3 4 5 6 7 8
yum -y install gcc gcc-c++ wget https://nodejs.org/dist/v12.13.1/node-v12.13.1.tar.gz tar -zxvf node-v12.13.1.tar.gz cd node-v12.13.1/ ./configure make make install node -v
3.使用淘宝镜像
3.1.设置镜像
1
npm config set registry https://registry.npmmirror.com