简体   繁体   English

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

[英]npm seems to ignore my private module and 404 against the public registry

Maybe someone has seen this before... I've got a private module that I want to include in my app.也许有人以前见过这个......我有一个私人模块,我想包含在我的应用程序中。 I've referenced it as a tarball on Gemfury, and everything works fine locally (always the way) over multiple versions of the library, but "npm install" on my Joyent box outputs the error below.我在 Gemfury 上将它引用为 tarball,并且在库的多个版本上一切正常(始终如此),但是我的 Joyent 框上的“npm install”输出以下错误。

NPM seems to be successfully pulling the module down, and then trying (and failing) to look it up on the registry. NPM 似乎成功地将模块拉下来,然后尝试(但失败)在注册表中查找它。

I assume I'm doing something stupid.我想我正在做一些愚蠢的事情。 Any ideas what it is?任何想法是什么?

Note:注意:

I've also tried referencing the module via a git URL in package.json.我还尝试通过 package.json 中的 git URL 引用模块。 SSH seems to connect, as it asks me whether I trust the IP & RSA fingerprint for github.com, but then NPM just hits the registry again and gets a 404. I'm guessing it's something to do with the package, but can't reproduce locally. SSH 似乎已连接,因为它询问我是否信任 github.com 的 IP 和 RSA 指纹,但随后 NPM 再次访问注册表并获得 404。我猜这与包有关,但可以' t 在本地繁殖。

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 for the app is this:应用程序的 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 of the library:库的 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"
  }
}

This is a case of bad defaults.这是一个错误的默认情况。 Use npm config the reset the registry URL:使用npm config重置注册表 URL:

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

TL;DR TL; 博士
run npm c delete registry运行npm c delete registry
If you are unsure whether or not you want to run the above command then run npm c get registry to see the value set for registry .如果您不确定是否要运行上述命令,请运行npm c get registry查看为registry设置的值。 It'll print out the value of key registry & then you can decide if you want to delete that or not.它会打印出registry的值,然后您可以决定是否要删除它。

Explanation:说明:
I had the same issue where I had pointed my default npm registry to my company's registry.我遇到了同样的问题,我将默认的 npm 注册表指向了我公司的注册表。 I solved the issue by deleting my npm default registry key value, using the above delete command.我通过使用上面的删除命令删除我的 npm 默认注册表项值解决了这个问题。

Notes: c in npm c get registry is short for config注: cnpm c get registry是短期的config
run npm c or npm config to see the available options运行npm cnpm config查看可用选项

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM