访问到nexus里面,然后登陆nexus构建的虚拟机。
copy仓库地址的url
输入下面命令:
npm admin --registry=【刚才复制的仓库地址】
输入仓库账号密码和邮箱, 登入到这个仓库中
然后cd 到你想上传的npm包路径下, 输入下面url
npm publish --registry=http:// ip:port/repository/my_repo_npm/
如果系tar包
npm publish cms-0.0.2.tgz --registry=http:// ip:port/repository/my_repo_npm/
如果遇到下面报错:
code E401
Unable to authenticate, need: BASIC realm="Sonatype Nexus Repository Manager"
首先排查账号密码问题
全局搜索 .npmrc打开文件修改,留下注册地址就行了,或者删除token哪一行
重新登录
npm login registry="你的地址"
如果你确认你的registry默认是正确的 可以省略registry="你的地址"
npm inst