JavaScript Automating Your Development with webpack Dev Server

Adam Beer
Adam Beer
11,264 Points

TypeError: validateSchema is not a function

I did something wrong? This is my wrong?

PS C:\Users\BeerQ\Desktop\webpack_IsaacLeeMorris-lesson-05-adding-styles\webpack-workshop> npm start

> webpack-treehouse-example@0.0.1 start C:\Users\BeerQ\Desktop\webpack_IsaacLeeMorris-lesson-05-adding-styles\webpack-workshop
> webpack-dev-server

C:\Users\BeerQ\Desktop\webpack_IsaacLeeMorris-lesson-05-adding-styles\webpack-workshop\node_modules\webpack-cli\bin\convert-argv.js:156
                const webpackConfigurationValidationErrors = validateSchema(
                                                             ^

TypeError: validateSchema is not a function
    at processConfiguredOptions (C:\Users\BeerQ\Desktop\webpack_IsaacLeeMorris-lesson-05-adding-styles\webpack-workshop\node_modules\webpack-cli\bin\convert-argv.js:156:48)
    at module.exports (C:\Users\BeerQ\Desktop\webpack_IsaacLeeMorris-lesson-05-adding-styles\webpack-workshop\node_modules\webpack-cli\bin\convert-argv.js:150:10)
    at Object.<anonymous> (C:\Users\BeerQ\Desktop\webpack_IsaacLeeMorris-lesson-05-adding-styles\webpack-workshop\node_modules\webpack-dev-server\bin\webpack-dev-server.js:234:54)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! webpack-treehouse-example@0.0.1 start: `webpack-dev-server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the webpack-treehouse-example@0.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\BeerQ\AppData\Roaming\npm-cache\_logs\2018-06-09T16_29_27_919Z-debug.log

convert-argv.js

const validateSchema = require("webpack").validateSchema; //7 line
function processConfiguredOptions(options) {
        const webpackConfigurationValidationErrors = validateSchema(  //156 line
            webpackConfigurationSchema,
            options
        );
Adam Beer
Adam Beer
11,264 Points

Jennifer Nordell have you any idea what is the problem? Thank you for your help. :)

Eric Atallah
Eric Atallah
1,185 Points

Same issue here. Any answers?

Adam Beer
Adam Beer
11,264 Points

If I good remember the solution then I worked next project folder and the wrong is gone. It was a very interesting mistake.

Balazs Pukli
Balazs Pukli
46,030 Points

Same issue here. BTW next to nothing actually works in this workshop, needs an update really badly.

Enrique Gomez-Salas
Enrique Gomez-Salas
16,131 Points

Hey managed to find a solution:

I went to the github project in the teachers file and opened package.json to the the version of webpack-dev-server. It was an issue with compatibility of versions. You need to change the version in your own package.json to:

"webpack-dev-server": "^1.14.1"

Then run

npm install

in the console again in order for it to make the changes in the version.

Additionally i had to install babe-core and webpack-cli

npm install --save-dev babe-core
npm install --save-dev webpack-cli