ubuntu 16.04 安裝nodejs


經過幾天的嘗試,終於裝好了:

1. nodejs官方推薦一下安裝方式:

NodeSource的二進制安裝腳本NodeSource

Using Ubuntu

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs

試了,不行,然后terminal提示我用:apt install nodejs

2. nvm 切換用戶的話,安裝好的node,就不見了
3. 最后使用Ubuntu提示的方式安裝:
apt install nodejs
apt all npm

成功安裝,但是版本很老,
node4.2.6
npm -v 3.2

終於發現了一個可以管理node版本的第三方庫,n來自tj大神。
安裝n有幾種方式,最快捷的是用npm安裝,前面的安裝已經為這里打好了鋪墊,現在只需要運行npm install -g n,安裝好后升級nodejsn latest

Use or install the latest official release:

$ n latest

Use or install the stable official release:

$ n stable


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM