npm 配置

15,446 阅读1分钟
  • 查看 npm 配置信息
npm config list
  • 查看当前 npm cacheprefix 路径
npm config get cache

npm config get prefix
  • 修改 cacheprefix 路径
npm config set cache "D:\software\nodejs\npm-cache"

npm config set prefix "D:\software\nodejs"
  • 设置 npm 镜像源
//  查看已配置的镜像源
npm config get registry

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

//  淘宝
npm config set registry http://registry.npm.taobao.org
  • 发布 npm
//  创建组织范围的程序包
npm init --scope = <您的组织名称>

//  发布公共组织范围的包
npm publish --access public

//  添加标签
npm publish --tag beta

//  当我们的prerelease版本已经稳定了,重新设置为稳定版本
npm dist-tag add bate@1.0.2 latest