npm安装非常方便,只需要执行一条语句

curl http://npmjs.org/install.sh | sudo sh
如果报错的话,可以先下载下来再执行
wget --no-check-certificate
chmod u+x install.sh
sh install.sh