下载地址:https://nodejs.org/en/download/
查看node版本
node -v C:\Users\username>node -v v12.16.0安装完成Node应该自带了NPM了,在控制台输入npm -v查看
npm -v C:\Users\username>npm -v 6.13.4npm默认的仓库地址是在国外网站,速度较慢,建议大家设置到淘宝镜像。但是切换镜像是比较麻烦的。推荐一款切换镜像的工具:nrm
我们首先安装nrm,这里-g代表全局安装
npm install nrm -g通过nrm ls命令查看npm的仓库列表,带*的就是当前选中的镜像仓库:
C:\Users\username>nrm ls npm -------- https://registry.npmjs.org/ yarn ------- https://registry.yarnpkg.com/ cnpm ------- http://r.cnpmjs.org/ * taobao ----- https://registry.npm.taobao.org/ nj --------- https://registry.nodejitsu.com/ npmMirror -- https://skimdb.npmjs.com/registry/ edunpm ----- http://registry.enpmjs.org/通过nrm use taobao来指定要使用的镜像源:
C:\Users\username>nrm use taobao Registry has been set to: https://registry.npm.taobao.org/通过nrm test npm来测试速度:
C:\Users\username>nrm test npm npm ---- 1668ms