npm 私有仓库使用指南

1. 概述

  • 服务器地址:http://172.30.3.107:8082
  • 登录和发布用户名与 svn 用户名一致
  • 新的 Nexus 支持 maven2 和 npm,并且对原有的 nexus 服务器进行了代理

2. 配置

npm config set registry http://172.30.3.107:8082/repository/npm_group/

或

yarn config set registry http://172.30.3.107:8082/repository/npm_group/

3. 发布

在 package.json 中配置以下内容(三项内容,缺一不可):

{
  "name": "npmt",
  "version": "1.0.1",
  "publishConfig" : {
    "registry" : "http://172.30.3.107:8082/repository/npm_hosted/"
  }
}

仅未登陆时执行

npm login -registry=http://172.30.3.107:8082/repository/npm_hosted/
npm publish