ubuntu
安裝node
和npm
的命令行命令:
sudo apt install nodejs-legacy sudo apt install npm
最新版本安裝方法
1、安裝npm
sudo apt install npm
2、升級npm
為最新版本
sudo npm install npm@latest -g
3、安裝用於安裝nodejs
的模塊n
sudo npm install -g n
4、然后通過n
模塊安裝指定版本的nodejs
,n
模塊更多介紹請參考官方文檔
//安裝官方最新版本 sudo n latest //安裝官方穩定版本 sudo n stable //安裝官方最新LTS版本 sudo n lts