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

前端 未结 8 1352
渐次进展
渐次进展 2021-01-04 01:57

\'Github\' asked me to update \'webpack-dev-server\' to version 3.1.11 or higher for security reasons.

However, \'npm run dev\' will not run after the update.

<
相关标签:
8条回答
  • 2021-01-04 02:54

    It is because of version of webpack-cli. In some versions, there is no config-yargs.js file. So ^3.3.11 version of webpack-cli worked for me. Try it:

    npm i webpack-cli@^3.3.11

    0 讨论(0)
  • 2021-01-04 02:55

    To fix it just do 2 things.

    1. Install npm i webpack-cli @webpack-cli/init
    2. Add this to your package.json:
      "scripts": {
        "start": "webpack-cli serve --mode development"
      },
      

    Done!

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