Skip to content

NPM 私有部署

如何创建私服

verdaccio

Verdaccio 可以帮我们快速创建一个本地的私有npm仓库

安装

npm install -g verdaccio

基本命令

  • 创建账号
shell
npm adduser --registry http://localhost:4873/
# 账号 密码 邮箱
  • 发布npm
shell
npm publish --registry http://localhost:4873/
  • 指定开启端口 默认 4873
shell
verdaccio --listen 9999
  • 指定安装源
shell
npm install --registry http://localhost:4873
  • 从本地仓库删除包
shell
npm unpublish <package-name> --registry http://localhost:4873