node-npm

npm包管理工具,(类似java中maven)

npm的命令

  • 【npm -v】查看npm的版本
  • 【nprm version】查看所有模块的版本
  • 【npm search 包名】搜索包
  • 【npm install/i 包名】安装包
  • 【npm install 包名 --save】 安装包并添加到依赖中
  • 【npm install 包名 -g】全局安装包(一般都是一些工具)
  • 【npm install 文件路径】 从本地安装
  • 【npm install 包名 -registry=地址】从镜像源安装
  • 【npm config set registry 地址】 设置镜像源
  • 【npm install】下载当前项目所依赖的包
  • 【npm remove/r 包名】删除包
  • 【npm remove 包名 --save】 删除包并在依赖中也删除
  • 【npm run build】打包

使用 nrm 切换镜像源

  • 下载 nrm:npm install -g nrm
  • 查看可切换的镜像源: 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 源名称 如:nrm use taobao
原文地址:https://www.cnblogs.com/xiaoaiying/p/14171018.html