Nexus 3 npm代理在大多数情况下失败

Nexus 3 npm代理在大多数情况下失败,npm,nexus,nexus3,Npm,Nexus,Nexus3,我们正在使用Nexus3.0.1-01代理 我们已经配置了一个组,其中包含到npmjs.org的代理和本地托管的npm repo。在本地npm配置中,我们将npm作为注册表指向我们的Nexus。 所有到internet的连接都通过我们公司的http(s)代理 当使用Nexus解决bower等“公共”依赖项时(例如,通过npm安装-g bower),它将失败10次中的8次。当我们指向官方注册时,一切都会100%正常 错误如下所示: $ npm install -g bower npm ERR! L

我们正在使用Nexus3.0.1-01代理 我们已经配置了一个组,其中包含到npmjs.org的代理和本地托管的npm repo。在本地npm配置中,我们将npm作为注册表指向我们的Nexus。 所有到internet的连接都通过我们公司的http(s)代理

当使用Nexus解决bower等“公共”依赖项时(例如,通过
npm安装-g bower
),它将失败10次中的8次。当我们指向官方注册时,一切都会100%正常

错误如下所示:

$ npm install -g bower
npm ERR! Linux 3.13.0-107-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "bower"
npm ERR! node v4.3.2
npm ERR! npm  v2.14.12

npm ERR! Cannot convert undefined or null to object
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     npm-debug.log
就像我说的,我们可以重复安装几次,最终它会工作。如果我们使用我们的代理,一切都很好

我们还有一个Nexus2.11.3-01,如果我们使用它作为npm注册表(代理),它也可以正常工作

我已经搜索了Sonatype JIRA,但找不到任何关于这是否是Nexus3问题的提示


任何提示都将不胜感激

好的,连同它,我能够解决这个问题

原来是乌贼身上的一种奇怪的虫子。在缓存配置中进行一些更改后,解析现在可以按预期工作


感谢所有参与的人的贡献

您使用的是什么版本的npm/node和操作系统?有助于我们重新创建此问题。您是否能够升级到最新版本(3.2.0)并查看是否存在此问题?我已做了一些进一步的调查。一个问题是npm不会每次都访问注册表。另一个原因是npm显然会在相当长的一段时间内缓存“未找到”的结果。。。在每次尝试解决时使缓存无效后,问题仍然存在。解析工作两次,然后失败(404),然后工作两次,然后失败。。。我们使用NPM1.3.10。这个版本不知道no_proxy变量,所以解析看起来像这样:npm=>proxy=>nexus=>proxy=>npmjs.org我怀疑这个代理是罪魁祸首…@DarthHater我现在已经进一步分析了这个问题。它影响所有NPM2.x版本(我们在节点4.3.2中使用NPM2.14.12)以及所有Nexus3.x版本。我已经针对Nexus2.x和Artifactory5进行了测试。两者都很好用。我们的内部代理是一个Squid,我想,我正试图从中获取配置。顺便说一下,它只影响组存储库。如果我只使用一个简单的代理回购(指向registry.npmjs.org),它也会起作用。使用组将破坏一切,即使该组中只有(工作)代理。
2 info using npm@2.14.12
3 info using node@v4.3.2
[...]
21 http request GET http://nexus/repository/npm/bower
22 http 404 http://nexus/repository/npm/bower
23 verbose headers { date: 'Thu, 02 Feb 2017 08:32:35 GMT',
23 verbose headers   server: 'Nexus/3.0.1-01 (OSS)',
23 verbose headers   'x-frame-options': 'SAMEORIGIN',
23 verbose headers   'x-content-type-options': 'nosniff',
23 verbose headers   'content-type': 'application/json',
23 verbose headers   'content-length': '37',
23 verbose headers   'x-cache': 'MISS from proxy',
23 verbose headers   'x-cache-lookup': 'HIT from proxy:3128',
23 verbose headers   connection: 'keep-alive' }
24 silly get cb [ 304, undefined ]
25 verbose get saving undefined to /user/.npm/nexus/repository/npm/bower/.cache.json
26 silly addNameTag next cb for bower with tag latest
27 verbose stack TypeError: Cannot convert undefined or null to object
27 verbose stack     at Function.keys (native)
27 verbose stack     at installTargetsError (/usr/lib/node_modules/npm/lib/cache/add-named.js:273:24)
27 verbose stack     at next (/usr/lib/node_modules/npm/lib/cache/add-named.js:94:10)
27 verbose stack     at RES (/usr/lib/node_modules/npm/node_modules/inflight/inflight.js:23:14)
27 verbose stack     at f (/usr/lib/node_modules/npm/node_modules/once/once.js:17:25)
27 verbose stack     at fixName (/usr/lib/node_modules/npm/lib/cache/add-named.js:29:5)
27 verbose stack     at saved (/usr/lib/node_modules/npm/lib/cache/caching-client.js:173:7)
27 verbose stack     at /usr/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:210:7
27 verbose stack     at FSReqWrap.oncomplete (fs.js:82:15)