NPM无法安装任何作用域包

时间:2017-06-22 21:08:06

标签: node.js angular npm install http-status-code-404

我在Node v6.10.3和NPM v3.8.6上。

我的问题是我无法安装任何作用域包。一切都返回404 Not Found。

以下列举了一些示例:

2 info using npm@3.8.6
3 info using node@v6.10.3
4 silly loadCurrentTree Starting
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 silly fetchPackageMetaData @angular/common@^4.1.2
8 silly fetchNamedPackageData @angular/common
9 silly mapToRegistry name @angular/common
10 silly mapToRegistry scope (from package name) @angular
11 verbose mapToRegistry no registry URL found in name for scope @angular
12 silly mapToRegistry using default registry
13 silly mapToRegistry registry http://registry.npmjs.org/
14 silly mapToRegistry data Result {
14 silly mapToRegistry   raw: '@angular/common',
14 silly mapToRegistry   scope: '@angular',
14 silly mapToRegistry   name: '@angular/common',
14 silly mapToRegistry   rawSpec: '',
14 silly mapToRegistry   spec: 'latest',
14 silly mapToRegistry   type: 'tag' }
15 silly mapToRegistry uri http://registry.npmjs.org/@angular%2fcommon
16 verbose request uri http://registry.npmjs.org/@angular%2fcommon
17 verbose request no auth needed
18 info attempt registry request try #1 at 4:58:49 PM
19 verbose request id cd941220750809c1
20 http request GET http://registry.npmjs.org/@angular%2fcommon
21 http 404 http://registry.npmjs.org/@angular%2fcommon
22 verbose headers { date: 'Thu, 22 Jun 2017 20:58:49 GMT',
22 verbose headers   'content-type': 'application/json',
22 verbose headers   'content-length': '21',
22 verbose headers   connection: 'keep-alive',
22 verbose headers   'cache-control': 'max-age=0',
22 verbose headers   'accept-ranges': 'bytes',
22 verbose headers   via: '1.1 varnish',
22 verbose headers   age: '0',
22 verbose headers   'x-served-by': 'cache-ord1732-ORD',
22 verbose headers   'x-cache': 'MISS',
22 verbose headers   'x-cache-hits': '0',
22 verbose headers   'x-timer': 'S1498165129.495392,VS0,VE389' }
23 silly get cb [ 404,
23 silly get   { date: 'Thu, 22 Jun 2017 20:58:49 GMT',
23 silly get     'content-type': 'application/json',
23 silly get     'content-length': '21',
23 silly get     connection: 'keep-alive',
23 silly get     'cache-control': 'max-age=0',
23 silly get     'accept-ranges': 'bytes',
23 silly get     via: '1.1 varnish',
23 silly get     age: '0',
23 silly get     'x-served-by': 'cache-ord1732-ORD',
23 silly get     'x-cache': 'MISS',
23 silly get     'x-cache-hits': '0',
23 silly get     'x-timer': 'S1498165129.495392,VS0,VE389' } ]
24 silly fetchPackageMetaData Error: Not found : @angular/common


1 verbose cli   'install',
1 verbose cli   '@types/jasmine' ]
2 info using npm@3.8.6
3 info using node@v6.10.3
4 silly loadCurrentTree Starting
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 silly fetchPackageMetaData @types/jasmine@2.5.38
8 silly fetchNamedPackageData @types/jasmine
9 silly mapToRegistry name @types/jasmine
10 silly mapToRegistry scope (from package name) @types
11 verbose mapToRegistry no registry URL found in name for scope @types
12 silly mapToRegistry using default registry
13 silly mapToRegistry registry http://registry.npmjs.org/
14 silly mapToRegistry data Result {
14 silly mapToRegistry   raw: '@types/jasmine',
14 silly mapToRegistry   scope: '@types',
14 silly mapToRegistry   name: '@types/jasmine',
14 silly mapToRegistry   rawSpec: '',
14 silly mapToRegistry   spec: 'latest',
14 silly mapToRegistry   type: 'tag' }
15 silly mapToRegistry uri http://registry.npmjs.org/@types%2fjasmine
16 verbose request uri http://registry.npmjs.org/@types%2fjasmine
17 verbose request no auth needed
18 info attempt registry request try #1 at 5:00:56 PM
19 verbose request id 7a34acc3581b3816
20 http request GET http://registry.npmjs.org/@types%2fjasmine
21 http 404 http://registry.npmjs.org/@types%2fjasmine
22 verbose headers { date: 'Thu, 22 Jun 2017 21:00:57 GMT',
22 verbose headers   'content-type': 'application/json',
22 verbose headers   'content-length': '2',
22 verbose headers   connection: 'keep-alive',
22 verbose headers   'cache-control': 'max-age=0',
22 verbose headers   'accept-ranges': 'bytes',
22 verbose headers   via: '1.1 varnish',
22 verbose headers   age: '0',
22 verbose headers   'x-served-by': 'cache-ord1729-ORD',
22 verbose headers   'x-cache': 'MISS',
22 verbose headers   'x-cache-hits': '0',
22 verbose headers   'x-timer': 'S1498165257.978535,VS0,VE139',
22 verbose headers   vary: 'Accept-Encoding' }
23 silly get cb [ 404,
23 silly get   { date: 'Thu, 22 Jun 2017 21:00:57 GMT',
23 silly get     'content-type': 'application/json',
23 silly get     'content-length': '2',
23 silly get     connection: 'keep-alive',
23 silly get     'cache-control': 'max-age=0',
23 silly get     'accept-ranges': 'bytes',
23 silly get     via: '1.1 varnish',
23 silly get     age: '0',
23 silly get     'x-served-by': 'cache-ord1729-ORD',
23 silly get     'x-cache': 'MISS',
23 silly get     'x-cache-hits': '0',
23 silly get     'x-timer': 'S1498165257.978535,VS0,VE139',
23 silly get     vary: 'Accept-Encoding' } ]
24 silly fetchPackageMetaData Error: Registry returned 404 for GET on http://registry.npmjs.org/@types%2fjasmine

到目前为止,我已尝试在范围上设置注册表(如下所示),更改npm版本,清除缓存以及删除节点模块。

  

npm config set @types:registry http://registry.npmjs.org/

到目前为止一切都没有效果。我觉得当npm尝试访问作用域包时可能会出现某种编码问题。我仍然可以安装所有未包装的包。

另一件事,我注意到这个问题只发生在npmjs注册表中。我为@progress(https://registry.npmjs.telerik.org)设置了另一个范围的注册表,我实际上可以从那里安装包。

任何建议或提示都将不胜感激。

1 个答案:

答案 0 :(得分:1)

发现这是由我公司的代理人造成的。

重定向导致转义的'/'成为未转义的,因此它正在点击https://registry.npmjs.org/@angular/core而非 https://registry.npmjs.org/@angular%2fcore