Webpack-cli: "Cannot read property 'validateSchema' of undefined" with [email protected] and [email protected]

Created on 2 Jun 2018  路  17Comments  路  Source: webpack/webpack-cli

Describe the bug

Webpack consistently fails to compile when using [email protected] with [email protected] (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.

Bug patch 馃敡

Most helpful comment

publishing a fix in a sec

All 17 comments

i've met the same problem,so i have no chioce but to use the "webpack-cli": "^2.1.5" and "webpack-dev-server": "^3.1.4"

for any one who wants to check on stackoverflow on this issue , i asked a question over there
https://stackoverflow.com/questions/50654594/webpack-v-3-0-0-validateschema-error-in-dev-mode

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

I am having the same problem and downgrading is also not working.. On downgrading I am facing this Error: Cannot find module 'webpack/bin/config-yargs' as this has been now moved to webpack-cli..

having same problem.

I have created a pull request to solve this issue pls have a look https://github.com/webpack/webpack-cli/pull/478

i have the same problem but i used webpack-dev-middleware instead of webpack-dev-server

publishing a fix in a sec

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.. 馃憤

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

Its working.. Thanks a lot 馃檹 馃憦 馃帀

This is actually on me 馃悞

same issue here. had to downgrade to make it work.

```
TypeError: Cannot read property 'validateSchema' of undefined

````

Try v3.0.1

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

i got
webpack-cli migrate webpack.config.js
/Users/z/project//node_modules/@webpack-cli/migrate/index.js:11 const { validate } = process.webpackModule;

@IzaGz upgrade to the version @and-why mentioned 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sam-s4s picture sam-s4s  路  5Comments

Pomax picture Pomax  路  3Comments

evenstensberg picture evenstensberg  路  5Comments

anyulled picture anyulled  路  4Comments

billyjanitsch picture billyjanitsch  路  3Comments