verdaccio搭建自己的私服仓库

824 阅读1分钟

1.npm adduser --registry http://192.168.1.104:4873/。注意。之前已经注册了,并且忘记密码的可以删除/verdaccio/storage/htpasswd里面的用户。重启即可

auth:

  htpasswd:

    file: /verdaccio/storage/htpasswd
  1. 添加全局npm i -g nrm包来管理源
  2. 添加verdaccio源仓库nrm add enpm http://192.168.1.104:4873/
  3. 通过命令nrm ls查看当前添加的镜像源。nrm use enpm来切换源。切换好源后,我们之后的 npm i 就会先去私有库查找包,如果不存在则会去 https://registry.npmjs.org/(因为上面配置了 proxy)查找包。
  4. 登录自己npmnpm login --registry http://172.16.0.192:4873/。输入账号、密码、邮箱
  5. 发布包npm publish