npm似乎忽略了我的私人模块和404公共注册表

时间:2013-11-28 10:25:53

标签: node.js npm joyent

也许有人之前见过这个...我有一个私人模块,我想要包含在我的应用程序中。我在Gemfury上把它作为一个tarball引用,并且在本地(总是那样)的所有内容都可以在库的多个版本上正常工作,但是我的Joyent框上的“npm install”会输出以下错误。

NPM似乎成功地将模块拉下来,然后尝试(并且失败)在注册表中查找它。

我认为我做的事情很愚蠢。有什么想法吗?

注意:

我也尝试通过package.json中的git URL引用该模块。 SSH似乎连接,因为它询问我是否信任IP&用于github.com的RSA指纹,但随后NPM再次点击注册表并获得404.我猜它与包有关,但无法在本地重现。

npm http GET https://npm.fury.io/--token--/richmarr/cake-lib/-/latest.tgz
npm http 200 https://npm.fury.io/--token--/richmarr/cake-lib/-/latest.tgz
npm http GET https://registry.npmjs.org/cake-lib/0.0.10
npm http 404 https://registry.npmjs.org/cake-lib/0.0.10
npm ERR! 404 'cake-lib' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, or http url, or git url.
npm ERR! System SunOS 5.11
npm ERR! command "/opt/nodejs/v0.10.21/bin/node" "/home/node/local/nodejs/bin/npm" "install" "https://npm.fury.io/--token--/richmarr/cake-lib/-/latest.tgz"
npm ERR! cwd /home/node/node-service/releases/2013-11-27T22-18-23.324752929
npm ERR! node -v v0.10.21
npm ERR! npm -v 1.3.11
npm ERR! code E404
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/node/node-service/releases/2013-11-27T22-18-23.324752929/npm-debug.log
npm ERR! not ok code 0

应用程序的package.json是这样的:

{
  "name": "application-name",
  "version": "0.0.3",
  "private": true,
  "scripts": {
    "start": "node app.js",
    "test": "mocha"
  },
  "dependencies": {
    "express": "3.2.1",
    "sizlate": "~0.8.3",
    "newrelic": "~0.11.0",
    "passport": "~0.1.17",
    "passport-twitter": "~1.0.2",
    "passport-local": "~0.1.6",
    "connect-flash": "~0.1.1",
    "passport-http": "~0.2.2",
    "helmet": "~0.1.0",
    "express-validator": "~0.8.0",
    "async": "~0.2.9",
    "cake-lib": "https://npm.fury.io/--token--/richmarr/cake-lib/-/latest.tgz"
  },
  "engines": {
    "node": "0.10.21"
  },
  "devDependencies": {
    "mocha": "~1.13.0"
  }
}

图书馆的package.json:

{
  "name": "cake-lib",
  "version": "0.0.10",
  "private": true,
  "description": "Data & connectivity lib",
  "main": "index.js",
  "scripts": {
    "test": "mocha",
    "pub": "npm version patch; npm pack; npm run upload",
    "upload": "curl -F package=@cake-lib-$npm_package_version.tgz https://push.fury.io/--token--; rm *.tgz"
  },
  "dependencies": {
    "scrypt": "~1.7.3",
    "mysql": "~2.0.0-alpha9",
    "awssum": "~1.1.1",
    "awssum-amazon": "~1.1.1",
    "awssum-amazon-ses": "~1.0.0",
    "stripe": "~1.3.0",
    "async": "~0.2.9",
    "apn": "~1.4.2",
    "uuid": "~1.4.1"
  },
  "repository": {
    "type": "git",
    "url": "git://github.com/richmarr/cake-lib.git"
  },
  "author": "",
  "bugs": {
    "url": "https://github.com/richmarr/cake-lib/issues"
  },
  "devDependencies": {
    "mocha": "~1.13.0"
  }
}

2 个答案:

答案 0 :(得分:0)

这是一个错误的默认情况。使用npm config重置注册网址:

npm config set registry https://npm.fury.io/

答案 1 :(得分:0)

TL; DR
运行 AsofMonth x1.A x2.A y.A x1.B x2.B y.B 1 1 5 6 10 2 4 2 3 2 5 5 12 2 6 3 5 3 6 2 13 4 4 5
如果 ,您不确定是否 您要运行上述命令,然后运行npm c delete registry来查看为 registry 设置的值。它将打印出键npm c get registry的值& 那么您可以决定是否要删除它。

说明:
我遇到了同样的问题,即我将默认的npm注册表指向了公司的注册表。我使用上述删除命令删除了npm默认注册表项值,从而解决了该问题。

注释registry中的cnpm c get registry的缩写
运行confignpm c以查看可用选项