小编cda*_*nea的帖子

如何将私有项目发布到Sinopia(私有注册表的npm adduser失败)

好的,所以我终于设法使用Sinopia获得私人npm注册表.但我无法发表任何内容.

TL; DR:Sinopia不支持npm adduser,但有自己的用户管理.此外,npm需要在 通过npm adduser 发布npm之前创建的有效用户,该用户失败,因为内部Sinopia服务器在不支持的命令中抛出错误....

如何使用Sinopia作为具有适当用户和密码的私人注册表

  1. 在npmjs.org中创建一个全局用户,然后在Sinopia中使用相同的密码创建另一个用户?
  2. 或者有一种更简单的方法告诉npm只使用固定的用户/通行证.
  3. 或者甚至更好地提示我用户名和密码?
  4. 别的什么?

概要:

Sinopia不依赖于Couch.DB,并且会从主服务器中获取它尚未拥有的包(默认为全局npmjs.org).

Sinopia完美启动并配置为侦听所有接口.它为包裹提供了奇迹

npm install
Run Code Online (Sandbox Code Playgroud)

我甚至将〜/ .npmrc配置为始终指向内部注册表.

所有项目的package.json文件都设置为

  ....
  "publishConfig" : {
     "registry" : "http://internal-npm:4873"
  },
  ....
Run Code Online (Sandbox Code Playgroud)

我还设法通过在js-yaml的帮助下操作config.yaml来在sinopia中添加自定义用户

crypto.createHash('sha1').update('theBigPassword').digest('hex')
Run Code Online (Sandbox Code Playgroud)

现在我被困在了

npm --registry=http://internal-npm:4873 --ca=null publish
Run Code Online (Sandbox Code Playgroud)

经过漫长的等待,我得到:

npm ERR! need auth auth and email required for publishing
npm ERR! need auth You need to authorize this machine using `npm adduser`

npm ERR! System Linux 3.11.0-18-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "--registry=http://internal-npm:4873" "--ca=null" "publish"
npm …
Run Code Online (Sandbox Code Playgroud)

package-managers node.js npm

20
推荐指数
3
解决办法
3万
查看次数

标签 统计

node.js ×1

npm ×1

package-managers ×1