New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
rydash opened this Issue Jun 2, 2018 · 17 comments

Comments

Projects
None yet
@rydash

rydash commented Jun 2, 2018

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.

@djlxiaoshi

This comment has been minimized.

djlxiaoshi commented Jun 2, 2018

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"

@a-m-dev

This comment has been minimized.

a-m-dev commented Jun 2, 2018

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

@a-m-dev

This comment has been minimized.

a-m-dev commented Jun 2, 2018

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

@dhanushuUzumaki

This comment has been minimized.

dhanushuUzumaki commented Jun 2, 2018

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

@ravshansbox

This comment has been minimized.

ravshansbox commented Jun 2, 2018

having same problem.

@juliantellez

This comment has been minimized.

juliantellez commented Jun 2, 2018

I have created a pull request to solve this issue pls have a look #478

@Johnsavadkuhi

This comment has been minimized.

Johnsavadkuhi commented Jun 2, 2018

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

@evenstensberg

This comment has been minimized.

Member

evenstensberg commented Jun 2, 2018

publishing a fix in a sec

@evenstensberg

This comment has been minimized.

Member

evenstensberg commented Jun 2, 2018

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.. 👍

@evenstensberg

This comment has been minimized.

Member

evenstensberg commented Jun 2, 2018

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

@dhanushuUzumaki

This comment has been minimized.

dhanushuUzumaki commented Jun 2, 2018

Its working.. Thanks a lot 🙏 👏 🎉

@evenstensberg

This comment has been minimized.

Member

evenstensberg commented Jun 2, 2018

This is actually on me 🐒

jp-ryuji added a commit to jp-ryuji/pluralsight-react-apps-with-relay-graphql-and-flux that referenced this issue Jun 3, 2018

@sahilsk

This comment has been minimized.

sahilsk commented Jun 3, 2018

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

TypeError: Cannot read property 'validateSchema' of undefined

@evenstensberg

This comment has been minimized.

Member

evenstensberg commented Jun 3, 2018

Try v3.0.1

@and-why

This comment has been minimized.

and-why commented Jun 3, 2018

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

@IzaGz

This comment has been minimized.

IzaGz commented Jul 9, 2018

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

@evenstensberg

This comment has been minimized.

Member

evenstensberg commented Jul 10, 2018

@IzaGz upgrade to the version @and-why mentioned 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment