简体   繁体   English

npm 安装问题... npm 错误! 代码 E400

[英]Problem with npm install… npm ERR! code E400

Firstly I installed the latest version of angular cli.首先,我安装了最新版本的 angular cli。 Then when I tried to downgrade to 7.3.3 there was an error: 400 Bad Request - GET https://github.com/ .然后,当我尝试降级到 7.3.3 时出现错误: 400 Bad Request - GET https://github.com/ Also I can not install anything with npm install like node-sass etc. So I unistalled nodejs and tried to install again angular cli, but the same error appeared.我也无法使用 npm 安装任何东西,比如 node-sass 等。所以我卸载了 nodejs 并尝试再次安装 angular cli,但出现了同样的错误。 Maybe I have changed any configuration.也许我改变了任何配置。

CMD CMD

C:\Windows\system32>node -v
v12.17.0

C:\Windows\system32>npm install -g @angular/cli
npm ERR! code E400
npm ERR! 400 Bad Request - GET https://github.com/

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\XXXX\AppData\Roaming\npm-cache\_logs\2020-06-01T10_49_37_560Z-debug.log

Logs日志

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   '-g',
1 verbose cli   '@angular/cli'
1 verbose cli ]
2 info using npm@6.14.4
3 info using node@v12.17.0
4 verbose npm-session bc2383db262e35f5
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 400 https://github.com/ 506ms
8 silly fetchPackageMetaData error for @angular/cli@latest 400 Bad Request - GET https://github.com/
9 timing stage:rollbackFailedOptional Completed in 1ms
10 timing stage:runTopLevelLifecycles Completed in 543ms
11 verbose stack Error: 400 Bad Request - GET https://github.com/
11 verbose stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\npm-registry-fetch\check-response.js:104:15
11 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:97:5)
12 verbose statusCode 400
13 verbose pkgid @angular/cli@latest
14 verbose cwd C:\Windows\system32
15 verbose Windows_NT 10.0.17763
16 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "@angular/cli"
17 verbose node v12.17.0
18 verbose npm  v6.14.4
19 error code E400
20 error 400 Bad Request - GET https://github.com/
21 verbose exit [ 1, true ]

1.>Go to your this location 1.>去你的这个位置

C:\Users\{your user name or ID}

2.> open.npmrc & Remove all content from.npmrc file. 2.> 打开.npmrc 并从.npmrc 文件中删除所有内容。

3.>reopen your new command prompt 3.>重新打开你的新命令提示符

4.>again run the code, will work. 4.>再次运行代码,就可以了。

you must enable developer mode first in windows 10您必须先在 windows 10 中启用开发者模式

  • setting环境
  • update & security更新和安全
  • for developers对于开发人员
  • and enable developer mode并启用开发者模式

图片

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

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