一、安装homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
二、安装node
brew install nodejs
三、设置npm国内镜像
$ npm install -g cnpm --registry=https://registry.npm.taobao.org
参考资料:
http://www.cnblogs.com/liuzejin/p/5832479.html