npm(macOS)安装步骤

原文:https://my.oschina.net/piscdong/blog/3113475

本文截取了原文中npm和cnpm的安装部分

安装npm

$ brew install node

npm直接使用淘宝镜像

$ npm install nrm -g
$ nrm use taobao

或者使用cnpm(不推荐)

$ npm install -g cnpm --registry=https://registry.npm.taobao.org
$ npm config set registry https://registry.npm.taobao.org

完成

补充:安装Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"