Closed englianhu closed 2 years ago
## https://nodejs.org/en curl -qL https://nodejs.org/dist/latest/ | sed -n '/linux-x64.tar.gz/p' wget https://nodejs.org/dist/v18.8.0/node-v18.8.0-linux-x64.tar.xz which node # /usr/bin/node which npm # /usr/bin/npm sudo rm -rf -R /usr/bin/node sudo rm -rf -R /usr/lib/node sudo rm -rf -R /usr/bin/npm sudo tar -xf node-v18.8.0-linux-x64.tar.xz -C /usr/lib/ sudo rm -rf node-v18.8.0-linux-x64.tar.xz sudo mv /usr/lib/node-v18.8.0-linux-x64 /usr/lib/node sudo chmod 777 -R /usr/lib/node sudo chmod 777 -R /usr/lib/npm ## /usr/lib/node/ ## 方案 01 npm ci npm config ls curl -qL https://www.npmjs.com/install.sh | sh echo "export PATH=/usr/lib/node/bin:${PATH}" | sudo tee /etc/profile.d/node.sh source /etc/profile.d/node.sh node -v ## 方案 02 echo "export PATH=/usr/lib/node/bin:${PATH}" | sudo tee -a $HOME/.profile #source source $HOME/.profile node -v
参考文献:
参考文献: