current position:Home>Webpack dev server cannot start normally cannot find module 'webpack / bin / config yargs‘

Webpack dev server cannot start normally cannot find module 'webpack / bin / config yargs‘

2022-06-24 09:07:53Secret Shura

webpack-dev-server Can't start normally

> webpack-dev-server

internal/modules/cjs/loader.js:796
    throw err;
    ^

Error: Cannot find module 'webpack/bin/config-yargs'
Require stack:

My original version is this
 Insert picture description here
npm run dev After the command Can't start normally , The problems of Netease point to the incompatibility of versions


Change the configuration to “dev”: “webpack serve --mode development”

reason : After upgrading webpack-dev-server And webpack-cli Not normally compatible ,

  "scripts": {
    
    "test": "echo \"Error: no test specified\" && exit 1",
    "dev": "webpack serve --mode development"
  },

I read this brother's blog
https://blog.csdn.net/Gemini_Kanon/article/details/114368812.
 Insert picture description here

copyright notice
author[Secret Shura],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/175/202206240625104589.html

Random recommended