1.安裝
sudo apt-get install nodejs #安裝node.js
sudo apt-get install npm #安裝npm【nodejs包管理器】
sudo npm install -g n #安裝n【多版本管理器】
2.在舊版本的基礎上升級【注意在安裝模塊的過程中發現安裝不成功很有可能是版本過低的原因】
Most up-to-date ppa for nodejs https://launchpad.net/~chris-lea/+archive/node.js/
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
NOTE: If your system does not have add-apt-repository, it can be installed like so:
sudo apt-get install python-software-properties
3.npm ERR! Error: failed to fetch from registry: supervisor
- npm config set registry http://registry.npmjs.org/