【问题标题】:getting 400 bad request error while installing webpack npm package安装 webpack npm 包时出现 400 错误请求错误
【发布时间】:2017-11-03 08:27:12
【问题描述】:

错误日志信息: 0 信息如果它以 ok 结尾,它就起作用了 1个详细的cli ['C:\ Program Files \ nodejs \ node.exe', 1 详细的 cli 'C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js', 1个详细的cli“安装”, 1个详细的cli'--save-dev', 1 详细的 cli 'webpack' ] 2 使用 npm@5.0.1 的信息 3 使用 node@v6.10.2 的信息 4 傻装loadCurrentTree 5 傻安装readLocalPackageData 6 http fetch GET 400 https://registry.npmjs.org/webpack 238ms 7 愚蠢的 fetchPackageMetaData 错误为 webpack@latest 400 错误请求(数据无效。):webpack@latest 8 详细堆栈错误:400 错误请求(数据无效。):webpack@latest fetch.then.res 的 8 个详细堆栈(C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\node_modules\pacote\lib\fetchers\registry\fetch.js:36:19) tryCatcher 的 8 个详细堆栈(C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\util.js:16:23) Promise._settlePromiseFromHandler 的 8 个详细堆栈(C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\promise.js:512:31) Promise._settlePromise 的 8 个详细堆栈(C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\promise.js:569:18) Promise._settlePromise0 的 8 个详细堆栈(C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\promise.js:614:10) Promise._settlePromises 的 8 个详细堆栈(C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\promise.js:693:18) Async._drainQueue 的 8 个详细堆栈(C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\async.js:133:16) Async._drainQueues 的 8 个详细堆栈 (C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\async.js:143:10) Immediate.Async.drainQueues 的 8 个详细堆栈(C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\async.js:17:14) runCallback 的 8 个详细堆栈 (timers.js:666:20) tryOnImmediate 的 8 个详细堆栈 (timers.js:639:5) processImmediate [as _immediateCallback] (timers.js:611:5) 的 8 个详细堆栈 9 详细 cwd D:\2017\ReactJSProject 10 详细的 Windows_NT 6.1.7601 11 详细 argv "C:\Program Files\nodejs\node.exe" "C:\Users\wf70\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "--save-开发” “网络包” 12 详细节点 v6.10.2 13 详细的 npm v5.0.1 14 错误代码 E400 15 错误 400 错误请求(数据无效。):webpack@latest 16 详细退出 [1, true]

【问题讨论】:

  • 您的网络似乎有问题。或者你可以尝试使用命令npm info webpack
  • 此命令执行成功,但安装包时出错
  • 也许您可以尝试执行这些命令:npm clean cachenpm install -g webpack@latest
  • 感谢它的工作

标签: node.js npm


【解决方案1】:

试试下面的:

选项 1

  1. 以管理员身份打开命令提示符
  2. npm uninstall -g webpack@latest
  3. npm cache clean
  4. npm config set strict-ssl false
  5. npm install -g webpack@latest

或者:

选项 2

  1. 以管理员身份打开命令提示符
  2. npm uninstall -g webpack@latest
  3. npm cache clean
  4. npm config set proxy="http://proxy.example.com:8080"
  5. npm config set https-proxy="http://proxy.example.com:8080"
  6. npm config set strict-ssl false
  7. npm install -g webpack@latest

如果得到错误原因:写EPROTO试试,

npm config set proxy="http://proxy.example.com:8080"
npm config set https-proxy="http://proxy.example.com:8080"

按照选项 2

如果以上都失败了,尝试安装最新的稳定版本的node & npm。

【讨论】:

    猜你喜欢
    • 2019-12-20
    • 2019-04-21
    • 2016-12-08
    • 2019-07-17
    • 1970-01-01
    • 2022-07-25
    • 2012-08-06
    • 2015-04-27
    • 1970-01-01
    相关资源
    最近更新 更多