npm的安装,升级与卸载

npm查询版本

npm -v

npm安装模块

【npm install xxx】利用 npm 安装xxx模块到当前命令行所在目录;

【npm install -g xxx】利用npm安装全局模块xxx;

npm升级

  1. window的升级方法
  2. 使用管理员身份打开powershell
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force//脚本执行策略设置

npm install -g npm-windows-upgrade

npm-windows-upgrade  //更新命令和下面一句起相同作用只是可能版本有差别

npm-windows-upgrade -p -v latest    //升级到最新版本

参考文档

npm卸载模块

【npm uninstall xxx】删除xxx模块;
【npm uninstall -g xxx】删除全局模块xxx;

本地安装时将模块写入package.json中

【npm install xxx】安装但不写入package.json;
【npm install xxx –save】 安装并写入package.json的”dependencies”中;
【npm install xxx --save-dev】安装并写入package.json的”devDependencies”中

npm查看源

npm config get registry

npm 安装淘宝镜像

npm install -g cnpm --registry=https://registry.npmmirror.com

改为官方镜像源

npm config set registry https://registry.npmjs.org/

改为淘宝镜像源

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

npm 相关命令

安装的时候什么都不输出(包含错误日志,警告日志)

npm install --silent

安装的时候只输出错误日志,警告日志

npm install --quiet

  

posted @ 2019-11-27 15:40  阿臻  阅读(15769)  评论(0编辑  收藏  举报