webpack-dev-server return "configuration has an unknown property 'error'"

webpack-dev-server return "configuration has an unknown property 'error'"

我安装了 webpack^3.0.0 和 webpack-dev-server^2.9.1(在项目中和全局)。 在项目根目录中 运行 webpack-dev-server 时,出现错误

Invalid configuration object. webpack-dev-server has been initialised 
using a configuration object that does not match the API schema.
 - configuration has an unknown property 'error'. These properties are 
valid:
object { hot?, hotOnly?, lazy?, bonjour?, host?, allowedHosts?, 
filename?, publicPath?, port?, socket?, watchOptions?, headers?, 
clientLogLevel?, overlay?, progress?, key?, cert?, ca?, pfx?, 
pfxPassphrase?, requestCert?, inline?, disableHostCheck?, public?, 
https?, contentBase?, watchContentBase?, open?, useLocalIp?, openPage?, 
features?, compress?, proxy?, historyApiFallback?, staticOptions?, 
setup?, before?, after?, stats?, reporter?, noInfo?, quiet?, 
serverSideRender?, index?, log?, warn? }

项目根目录下的 webpack.config.js 文件包含以下内容:

module.exports = {
  entry: {
    app: [
      './src/index.js'
    ]
  },
  module: {
    loaders: [{
      test: /\.jsx?$/,
      exclude: /node_modules/,
      loader: 'babel-loader'
    }]
  },
  resolve: {
    extensions: ['*', '.js', '.jsx']
  },
  output: {
    path: __dirname + '/dist',
    publicPath: '/',
    filename: 'bundle.js'
  },
  devServer: {
    inline: false,
    contentBase: './dist'
  }
};

我已尝试遵循 中的建议,但无济于事。如何启动 webpack?

我还注意到,当我全局安装 webpack-dev-server^2.9.1 时,它拒绝承认它的 webpack^3.0.0 对等体,尽管它存在。有关系吗?

问题与问题末尾提到的全局安装有关。似乎项目根目录中的 运行 webpack-dev-server 导致项目安装和全局安装都 spring 生效,因此它们相互之间存在端口冲突。其中一个在检测到此冲突时抛出错误,另一个发现此错误并认为这是额外的配置输入。

使用 webpack-dev-server 的项目安装解决了这个问题。

已在 webpack-dev-server 库版本 2.9.3 中解决(global/local 实例冲突)。

已关闭 github 问题:https://github.com/webpack/webpack-dev-server/issues/1142