npm cnpm yarn 安装

安装node.js,其中已经集成了npm,可以将npm切换到国内镜像

$ npm config set registry https://registry.npm.taobao.org
-- 配置后可通过下面方式来验证是否成功
$ npm config get registry
-- 或 npm info express

安装yarn

npm install -g yarn
//查看版本
yarn -v

安装cnpm

npm install -g cnpm --registry=https://registry.npm.taobao.org
//查看版本
cnpm -v

添加系统变量path的内容

  因为cnpm或yarn会被安装到D:\Program Files\nodejs\node_global下,而系统变量path并未包含该路径。在系统变量path下添加该路径即可正常使用cnpm或yarn。

卸载全局安装的

npm uninstall vue-cli -g

npm常用命令

npm -v          #显示版本,检查npm 是否正确安装。  

 npm install express   #安装express模块  

 npm install -g express  #全局安装express模块  

 npm list         #列出已安装模块  

 npm show express     #显示模块详情  

 npm update        #升级当前目录下的项目的所有模块  

 npm update express    #升级当前目录下的项目的指定模块  

 npm update -g express  #升级全局安装的express模块  

 npm uninstall express  #删除指定的模块
 npm uninstall express -g  #删除全局指定的模块
 

 升级npm

npm install npm@latest -g

 安装live-server

npm install -g live-server

 

posted @ 2019-01-03 10:22  杜子烟  阅读(493)  评论(0编辑  收藏  举报