2
参考文档 https://help.sonatype.com/rep...

前置条件

搭建好nexus 3

一.创建npm仓库

1.创建nx-deployer 角色
图片描述
2.创建deployer 用户 密码也为 deploye
图片描述
3.分别创建npm的hosted、proxy和group分别为下面三幅图
hosted
图片描述

proxy
图片描述

group
图片描述

二、客户端的.npmrc配置

registry=http://192.168.48.128:8081/repository/npm-all/
email=deployer@skytech.com
always-auth=true
_auth="ZGVwbG95ZXI6ZGVwbG95ZXI="

_auth是 username:password 的base64值

以上是可以publish的最低配置
如果只想install 只配置registry即可

三、发布控件到npm私服中

在package.json 配置

  "publishConfig":{
     "registry":"http://192.168.48.128:8081/repository/npm-internal/"
  },

用npm publish 发布即可。


麻吉
7 声望0 粉丝

混迹于事务项目的‘全栈’码农