1. 安装NodeJS
到官网下载安装
2. 使用Node命令
安装完成后,查看NodeJS的版本:
node -v
npm -v
3. 安装nrm
nrm是一个管理 npm 源的工具,用来切换官方 npm 源和国内的 npm 源(如:cnpm),当然也可以用来切换官方 npm 源和公司私有 npm 源
全局安装nrm
npm i nrm -g
查看当前nrm内置的几个npm源地址:
C:\Users\zhangyanming > nrm ls
npm ---- https://registry.npmjs.org/
cnpm --- http://r.cnpmjs.org/
* taobao - https://registry.npm.taobao.org/
nj ----- https://registry.nodejitsu.com/
rednpm - http://registry.mirror.cqupt.edu.cn/
npmMirror https://skimdb.npmjs.com/registry/
edunpm - http://registry.enpmjs.org/
切换到cnpm
C:\Users\zhangyanming > nrm use cnpm
verb config Skipping project config: C:\Users\zhangyanming/.npmrc. (matches userconfig)
Registry has been set to: http://r.cnpmjs.org/
C:\Users\zhangyanming > nrm ls
npm ---- https://registry.npmjs.org/
* cnpm --- http://r.cnpmjs.org/
taobao - https://registry.npm.taobao.org/
nj ----- https://registry.nodejitsu.com/
rednpm - http://registry.mirror.cqupt.edu.cn/
npmMirror https://skimdb.npmjs.com/registry/
edunpm - http://registry.enpmjs.org/