无法安装webpack-dev-server

时间:2015-09-22 16:59:31

标签: webpack webpack-dev-server

我无法安装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包的问题吗?

2 个答案:

答案 0 :(得分:0)

通过在工作中与朋友交谈,这不是问题。我们根本不需要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"]

答案 1 :(得分:0)

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