Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Automating Your Development with webpack Dev Server

Adam Beer
Adam Beer
11,314 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
        );
Brandon Little
Brandon Little
30,417 Points

I've got the same error. No idea why.

Adam Beer
Adam Beer
11,314 Points

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

Same issue here. Any answers?

Adam Beer
Adam Beer
11,314 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 Peak
Balazs Peak
46,160 Points

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

Same issue

1 Answer

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