ubuntu16.04安裝node.js、npm
1.請盡量避免在 Ubuntu 上使用 apt-get 來安裝 node.js, 如果你已經這么做了,請手動移除:
sudo apt-get purge nodejs && sudo apt-get autoremove && sudo apt-get autoclean
2.使用以下命令安裝 NVM(通過NVM安裝node.js):
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
3.命令行下測試NVM是否安裝成功(在這之前可能需要重啟一下系統才能使用NVM):
nvm --version
4.使用以下命令安裝node.js 8.* LTS 版本 (長久維護版本):
nvm install 8.11.2
5.設置系統默認版本:
nvm use 8.11.2 nvm alias default 8.11.2
6.檢測node.js版本:
node -v
7.npm使用淘寶鏡像:
npm config set registry=https://registry.npm.taobao.org
8.npm更新到最新版本:
npm install -g npm
9.安裝完成,檢測npm版本:
npm -v
---------------------
作者:時間玫瑰
來源:CSDN
原文:https://blog.csdn.net/qq_28263253/article/details/81809067
版權聲明:本文為博主原創文章,轉載請附上博文鏈接!