1. 配置npm仓储

      npm config set registry 仓库地址

    2. 验证配置是否正确

      npm config list

    image.png

    1. 添加用户

      npm adduser -registry 仓库地址

    1. npm adduser -registry http://xxx.xx.x.x:xxxx/repository/npm-hosted/
    2. Username: admin
    3. Password:
    4. Email: (this IS public) demo-test@devops.com
    5. Logged in as admin on http://xxx.xx.x.x:xxxx/repository/npm-hosted/.
    1. 上传包

      npm publish -registry 仓库地址 https://registry.npmjs.org/ 或者 现在package.json 添加仓库地址 “publishConfig”: { “registry”: “仓库地址” } npm publish