Linux 安装Nodejs
1.cd /usr/local/src/
2.下载 node
wget https://nodejs.org/dist/v15.4.0/node-v15.4.0-linux-x64.tar.xz
3.解压文件
tar xf node-v15.4.0-linux-x64.tar.xz
4.导航至解压目录
cd node-v15.4.0-linux-x6
5.运行node查看版本,确认是否安装成功:
./bin/node -v
6.设置node软链接:
ln -s /usr/local/src/node-v15.4.0-linux-x64/bin/node /usr/local/bin/
7.设置npm软链接:
ln -s /usr/local/src/node-v15.4.0-linux-x64/bin/npm /usr/local/bin/
8.设置cnpm软链接:
ln -s /usr/local/src/node-v15.4.0-linux-x64/bin/cnpm /usr/local/bin/
cd /usr/local/
# 创建安装目录
mkdir nodejs
cd nodejs/
# 下载node
wget https://npm.taobao.org/mirrors/node/latest-v14.x/node-v14.2.0-linux-x64.tar.gz
# 解压缩
tar zxvf node-v14.2.0-linux-x64.tar.gz
ln -s /usr/local/nodejs/node-v14.2.0-linux-x64/bin/npm /usr/local/bin/
ln -s /usr/local/nodejs/node-v14.2.0-linux-x64/bin/node /usr/local/bin/
ln -s /usr/local/nodejs/node-v14.2.0-linux-x64/bin/cnpm /usr/local/bin/
node -v