webpack.validateSchema is not a function

后端 未结 10 2060
遇见更好的自我
遇见更好的自我 2020-12-13 12:54

Webpack are throwing this error all of a sudden:

TypeError: webpack.validateSchema is not a function

Everything was working fine

相关标签:
10条回答
  • 2020-12-13 13:03

    I got it working by running this command:

    npm install --save-dev webpack-dev-server@beta webpack@beta
    
    0 讨论(0)
  • 2020-12-13 13:11

    it worked for me when i delete ^ and use the exact version.

    From

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

    to

    "webpack": "2.1.0-beta.25",
    "webpack-dev-middleware": "1.6.1",
    "webpack-dev-server": "2.1.0-beta.9",
    "webpack-md5-hash": "0.0.5",
    "webpack-merge": "0.14.1"
    
    0 讨论(0)
  • 2020-12-13 13:15

    Looks like npm bug, since webpack-dev-server@2.1.0-beta.11 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.

    0 讨论(0)
  • 2020-12-13 13:18

    It worked for me when i did:

    Uninstall following package:

    npm uninstall webpack webpack-dev-server --save -dev

    Install following Packages:

    npm install --save -dev webpack@3.10.0

    npm install --save -dev webpack-cli@2.0.10

    npm install --save -dev webpack-dev-server@2.9.7

    0 讨论(0)
  • 2020-12-13 13:21

    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 webpack-dev-server@2.1.0-beta.11 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.

    0 讨论(0)
  • 2020-12-13 13:23

    Alright, update here.

    Tried what a few of you guys suggested, which unfortunately just got me deeper into a rabbit hole of errors with broken module loaders.

    In the end, I updated to "webpack": "^2.1.0-beta.26", and "webpack-dev-server": "^2.1.0-beta.11". After that, found out there were breaking changes, causing the loaders to break - https://github.com/webpack/webpack/releases.

    in short, in your webpack config, change loaders: [ ... ], to rules : [ ... ], and on all loader declarations, append "-loader" to the string value as this, { test: /node_modules\/i18n-iso-countries\/(de|es|nl|sv)\.js$/, loader: 'null-loader' }, { test: /\.coffee$/, loader: 'coffee-loader' }, { test: /\.ts$/, loader: ['awesome-typescript-loader']} etc.

    Did it for me. Hope this helps anyone else running into the issue.

    0 讨论(0)
提交回复
热议问题