npm 私服搭建


npm 私服搭建

  1. 安装yarn global add verdaccio
  2. 启动 verdaccio
  3. 在浏览器访问默认地址http://localhost:4873/
  4. 创建用户(注意:输入密码时不显示) npm adduser --registry http://localhost:4873/
Username: xxx
Password:
Email: (this IS public) xxx@qq.com
Logged in as xxx on http://localhost:4873/.
  1. npm 私有包发布npm publish --registry http://localhost:4873/
  2. npm 私有包下载 npm install package-name --registry http://localhost:4873/
  3. 发布包版本 npm version 后面参数说明:
    • patch:小变动,比如修复 bug 等,版本号变动 v1.0.0->v1.0.1
    • minor:增加新功能,不影响现有功能,版本号变动 v1.0.0->v1.1.0
    • major:破坏模块对向后的兼容性,版本号变动 v1.0.0->v2.0.0

参考文章: