webpack-cli: "Cannot read property 'validateSchema' of undefined" with webpack-cli@3.0.0 and webpack-dev-server@3.1.4

Describe the bug

Webpack consistently fails to compile when using webpack-cli@3.0.0 with webpack-dev-server@3.1.4 (the current latest). I am uncertain whether this is a new issue in this major or if webpack-dev-server needs to get with the times.

What is the current behavior?

When running webpack-dev-server from an npm script, compilation fails with the following error:

TypeError: Cannot read property 'validateSchema' of undefined
    at Object.<anonymous> (~/repos/node_modules/webpack-cli/bin/convert-argv.js:7:46)
    at Module._compile (internal/modules/cjs/loader.js:702:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
    at Function.Module._load (internal/modules/cjs/loader.js:543:3)
    at Module.require (internal/modules/cjs/loader.js:650:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (~/repos/node_modules/webpack-dev-server/bin/webpack-dev-server.js:234:15)
    at Module._compile (internal/modules/cjs/loader.js:702:30)

This happens every time. The existence of a webpack.config.js file doesn’t matter.

To Reproduce

  1. Create a new project with npm init.
  2. npm install webpack webpack-dev-server webpack-cli --save-dev
  3. In your package.json, create "scripts": { "start": "webpack-dev-server" }.
  4. npm run start
  5. Error!

Expected behavior Webpack compilation completes successfully, and the result is served according to webpack-dev-server’s configuration.

Please paste the results of webpack-cli info here, and mention other relevant information Promise { <pending> }

(That’s the result I get when running webpack-cli info after installing the new @webpack-cli/info package. It’s possible I’m using this wrong.)

Additional notes If this is actually an issue with webpack-dev-server, my apologies! I’ll take my concern there once we can rule out webpack-cli.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 23
  • Comments: 17 (6 by maintainers)

Most upvoted comments

publishing a fix in a sec

Patch out now, could you guys confirm it’s not an issue anymore?

Pushed to master now, give it 20 minutes at it and it should be fine. Sorry for the inconvenience, webpack & webpack-cli doesn’t play ball on path lookups… 👍

This is actually on me 🐒

i downgraded to "webpack-cli": "^2.1.4" and it works well as hell , but i wanna know that is the problem with version 3???

Had to update webpack-cli to v3.0.1 and it now works again. Thanks