安装webpack npm包时出现400错误请求错误

时间:2017-06-02 03:18:32

标签: node.js npm

错误日志信息: 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 verbose cli' - save-dev', 1详细的cli' webpack' ] 2信息使用npm@5.0.1 3 info使用node@v6.10.2 4傻安装loadCurrentTree 5傻安装readLocalPackageData 6 http获取GET 400 https://registry.npmjs.org/webpack 238ms 7 webly最新的400 Bad Request错误的fetchPackageMetaData错误(数据无效。):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) Instant.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 8中的详细堆栈[as _immediateCallback](timers.js:611:5) 9 verbose cwd D:\ 2017 \ ReactJSProject 10详细的Windows_NT 6.1.7601 11 verbose argv" C:\ Program Files \ nodejs \ node.exe" " C:\用户\ wf70 \应用程序数据\漫游\ NPM \ node_modules \ NPM \ BIN \ NPM-cli.js" "安装" " - 保存-dev的" "的WebPack" 12详细节点v6.10.2 13详细npm v5.0.1 14错误代码E400 15错误400错误请求(数据无效。):webpack @ latest 16详细退出[1,true]

1 个答案:

答案 0 :(得分:0)

尝试以下方法:

选项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

OR:

选项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 try,

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

遵循选项2

如果以上所有方法均失败,请尝试安装node&npm的最新稳定版本。