【问题标题】:Can't npm install webpack-dev-server无法 npm 安装 webpack-dev-server
【发布时间】:2015-09-22 16:59:31
【问题描述】:

我无法安装 webpack-dev-server:

npm install -g webpack-dev-server

我得到:

gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
npm ERR! Failed at the bufferutil@1.2.1 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the bufferutil package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls bufferutil
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR!     D:\...\npm-debug.log

我需要安装 python 吗?我怎样才能完成它?是bufferutil包的问题吗?

【问题讨论】:

  • 如果我没记错的话,(node-)gyp 需要安装 pyhton 2。你在哪个平台上?
  • 我的应用在 Windows 7 上运行。

标签: webpack webpack-dev-server


【解决方案1】:

通过与工作中的朋友交谈,这不是问题。我们根本不需要 Python。

我会对此进行更多研究。到目前为止,我已经安装并运行了,但我的不太好用。它尝试加载页面,然后失败,并显示一个关于组合器的警告。

/deep/ combinator is deprecated. See https://www.chromestatus.com/features/6750456638341120 for more details.

这是我为使其正常工作而遇到的问题和修复的一个小时间表。重新加载似乎比我想象的要慢得多!

 1. 

Problem: Stuck pulling http://localhost:8080/webpack-dev-server/

fix: http://127.0.0.1:8080/

 2. 

Problem: which didn't allow for watch to reupdate

Fix:  change entry in webpack.config.js to entry: [
    "./app.js",
    'webpack/hot/only-dev-server', ] and include 
        <script src="https://localhost:8080/webpack-dev-server.js"></script> to the index.html and run webpack-dev-server --inline

 3. 

Problem: Then started getting: Errors while compiling. App updated with errors. No reload!     multi main Module not found: Error: Cannot resolve module 'webpack/hot/only-dev-server' in C:\Users\KRebstock\Desktop\reactexamples\webpack example1 resolve module webpack/hot/only-dev-server in C:\Users\KRebstock\Desktop\reactexamples\webpack example1  @ multi main

Fix:   removed
     'webpack/hot/only-dev-server', from  webpackage.config.js  in  entry: ["bla","bla"]

【讨论】:

    【解决方案2】:

    您可以尝试在没有安装后脚本的情况下安装它 (npm i -g webpack-dev-server --ignore-scripts)。它将以这种方式工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-07-27
      • 2021-10-18
      • 2021-02-26
      • 2020-01-21
      • 2019-12-29
      • 2021-05-07
      • 2018-02-19
      • 1970-01-01
      相关资源
      最近更新 更多