Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

webpack.validateSchema is not a function

Webpack are throwing this error all of a sudden:

TypeError: webpack.validateSchema is not a function

Everything was working fine Friday, not working today. No new commits to master since Friday.

Pruned NPM, that didn't work, deleted NPM folder and re-installed, no dice. Checked out to previous branches which have not been rebased from Master for over a week. Still the same.

Anyone have an idea?

like image 406
Christoffer Johansen Avatar asked Nov 14 '16 20:11

Christoffer Johansen


2 Answers

Looks like npm bug, since [email protected] requires webpack@^2.1.0-beta.26 but npm failed to install it.

The easiest way to avoid the issue without updating too much is to change dependency in package.json to

  "webpack-dev-server": "2.1.0-beta.10",

Instead of something like

  "webpack-dev-server": "^2.1.0-beta.9",

"^" char before version says "compatible with". Removing it sticks to the version exactly.

Don't forget to run npm install or npm update afterwards.

like image 94
BartBiczBoży Avatar answered Oct 22 '22 01:10

BartBiczBoży


I ran into this problem today at virtually the same time as you, it turns out that webpack was updated again.

Here is what I did to fix it:

First I ran npm install and npm update to see what the result was. I ran both of these commands because npm has a weird way of reporting unmet dependancies, sometimes its wrong and when you re-run the npm update or the npm install, you will realize that the unmet dependencies are no longer an issue.

After I ran these commands I noticed that the only remaining message was a warning:

npm WARN [email protected] requires a peer of webpack@^2.1.0-beta.26 but none was installed.

To get rid of this I changed my package.json file to read "webpack": "2.1.0-beta.26" instead of "webpack": "2.1.0-beta.25" and ran another npm install.

After this I got another error when I tried running npm start which stated that there was a problem with my webpack config file. In my case, I went to the webpack config file for my development environment (because I am not on production yet) and I found the culprit which was an invalid parameter called 'outputPath'.

I commented out that line and now I get everything working fine.

Hope this helps, may just be a hack for now but hopefully it is a step in the right direction.

UPDATE:

Ok, so I was a bit wrong about everything 'working fine'. It turns out that some of my loaders were not working correctly; Bootstrap and some other things were not being loaded in properly, breaking my styles. So, to get it back to where I was before, I deleted my node_modules folder and ran npm install using the following in package.json:

"webpack": "2.1.0-beta.25",
"webpack-dashboard": "^0.1.8",
"webpack-dev-middleware": "^1.6.1",
"webpack-dev-server": "2.1.0-beta.9",
"webpack-md5-hash": "^0.0.5",
"webpack-merge": "^0.15.0",

Hopefully discussions like this one will help us figure out how to move forward properly with the new versions of webpack being released.

like image 11
Moose Avatar answered Oct 22 '22 02:10

Moose