1.npm adduser --registry http://192.168.1.104:4873/。注意。之前已经注册了,并且忘记密码的可以删除/verdaccio/storage/htpasswd里面的用户。重启即可
auth:
htpasswd:
file: /verdaccio/storage/htpasswd
- 添加全局
npm i -g nrm包来管理源 - 添加
verdaccio源仓库nrm add enpm http://192.168.1.104:4873/ - 通过命令
nrm ls查看当前添加的镜像源。nrm use enpm来切换源。切换好源后,我们之后的npm i就会先去私有库查找包,如果不存在则会去https://registry.npmjs.org/(因为上面配置了proxy)查找包。 - 登录自己
npm源npm login --registry http://172.16.0.192:4873/。输入账号、密码、邮箱 - 发布包
npm publish