wget https://nodejs.org/download/release/v12.1.0/node-v12.1.0-linux-x64.tar.gz -P /opt/
tar xzvf /opt/node-v12.1.0-linux-x64.tar.gz -C /usr/local/
mv /usr/local/node-v12.1.0-linux-x64/ /usr/local/node
cat >> /etc/profile << EOF
export NODE_HOME=/usr/local/node
export PATH=\$PATH:\$NODE_HOME/bin:/opt/node_global/bin
export NODE_PATH=\$NODE_HOME/lib/node_modules
EOF
source /etc/profile
npm -v
mkdir -p /usr/local/node/etc/
mkdir /opt/node_global
mkdir /opt/node_cache
mkdir /usr/local/node/etc/
cat > /usr/local/node/etc/npmrc << EOF
registry=http://registry.npm.taobao.org/
prefix=/opt/node_global
cache=/opt/node_cache
EOF
npm get registry
nvm 安装
centos7
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
source /root/.bashrc
nvm --version
0.33.8
安装指定版本node
nvm install v12.18.2
nvm install v16.14.2
使用指定版本node
nvm use 12.18
npm config set registry https://registry.npm.taobao.org/
npm set sass_binary_site https://npm.taobao.org/mirrors/node-sass
npm install 报错
npm ERR! The unauthenticated git protocol on port 9418 is no longer supported.
vue-element-admin
git --version
git version 2.27.0
node --version
v12.18.2
python --version
Python 3.8.11
cat /root/.gitconfig
[url "https://"]
insteadOf = ssh://
[url "https://"]
insteadOf = git://
rm -rf /opt/node_cache/*
npm install --registry=https://registry.npm.taobao.org
macos
npm --version
6.14.5
node --version
v12.18.2
git --version
git version 2.32.0 (Apple Git-132)
python --version
Python 2.7.18
git config --global url."https://".insteadOf git://
npm install --registry=https://registry.npm.taobao.org
npm run dev