3

I have webpack^3.0.0 and webpack-dev-server^2.9.1 installed (both on the project and globally). Upon running webpack-dev-server in the project root, I am presented with the error

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? }

the webpack.config.js file at the projet root contains the following:

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'
  }
};

I have tried following the advice in this SO question but to no avail. How can I get webpack to start?

I've also noticed that when I installed webpack-dev-server^2.9.1 globally, it refused to acknowledge its peer of webpack^3.0.0 despite the fact that it was present. Is that related?

David Hatton
  • 337
  • 1
  • 3
  • 10

2 Answers2

6

The problem was related to the global installations mentioned at the end of the question. It appears that running webpack-dev-server from the project root caused both the project install and the global install to spring into action, thus they had a mutual port-conflict. One of them threw an error upon detecting this conflict, and the other one picked up this error thinking that it was additional configuration input.

Using the project install of webpack-dev-server resolved the issue.

David Hatton
  • 337
  • 1
  • 3
  • 10
  • Exactly what I was looking for. I uninstalled the local webpack-dev-server and it works fine now. For some reason, npm start (which was configured to run webpack-dev-server) never threw any error. – Omer Oct 12 '17 at 17:30
2

Solved in webpack-dev-server library version 2.9.3 (global/local instance conflict).

Closed github issue: https://github.com/webpack/webpack-dev-server/issues/1142

TheJeff
  • 3,665
  • 34
  • 52
Patrik Šimunič
  • 449
  • 1
  • 4
  • 16