NPM安装包下载:http://nodejs.cn/download/

 

在国内使用npm安装的会非常缓慢

npm install

建议使用淘宝的镜像仓库来替代的原有的镜像仓库(镜像仓库就是一个npm的下载源,换成国内的下载源,下载速度会提升很多)

 

# 在安装时候临时指定

$ npm --registry http://registry.cnpmjs.org info express

# 持久使用(推荐)

$ npm config set registry https://registry.npm.taobao.org

$ npm config set registry https://registry.npmmirror.com

 

查看npm配置

$ npm config list
# 其他查看配置的方式
$ npm config get globalconfig
$ npm config ls -l

 

 

npm 升级到最新版

$ npm install npm -g
如果要指定版本,可以通过@指定版本
$ npm install npm@3.10.10 -g

 

 

 

常用命令:

npm -v

npm run serve

npm run build

npm install

npm cache clean -f