2017-04-03 44 views
2

我已經使用以下設置安裝了webpack dev服務器,它在Firefox和Safari上正常工作,但不適用於Chrome。Webpack Dev Server適用於除Chrome以外的所有瀏覽器?

我得到這個消息:

這個網站無法達到

本地主機拒絕連接。 搜索谷歌本地主機3005 ERR_CONNECTION_REFUSED

webpack.config.js

const webpack = require('webpack'); 
const nodeEnv = process.env.NODE_ENV || "production"; 

module.exports = { 
    entry: { 
     filename: "./index.js" 
    }, 
    output: { 
     filename: "./build/bundle.js" 
    }, 
    module: { 
     loaders: [ 
      { test: /\.js$/, 
       exclude: /node_modules/, 
       loader: "babel-loader", 
       query: { 
        presets: ['es2015', 'react'] 
       } 
      } 
     ] 
    }, 
    devServer: { 
     inline: true, 
     contentBase: "public", 
     port: 3005 
    } 
} 
+0

嘗試另一個端口? –

+0

嘗試3000,3005,3015沒有運氣。 –

+0

是否還有其他錯誤信息?在終端上,或在瀏覽器控制檯也許? –

回答

0

我有同樣的問題,並設法通過我的hosts文件中添加新的寄存器來解決這個問題:

  • 打開/etc/hosts帶有sudo特權的文本編輯器
  • 將以下行添加到文件中:

127.0.0.1 localhost

相關問題