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

前端 未结 8 1343
渐次进展
渐次进展 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:31

    webpack core team says that form version 3+ the compatibility will foucs on webpack 4

    so I think you need also to update webpack 3 to webpack 4

    this doc may help you to achieve that https://webpack.js.org/migrate/4

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

    Delete package-lock.json file. Change following in package.json.

    "webpack": "^4.32.2",
    "webpack-cli": "^3.3.0",
    "webpack-dev-server": "^3.11.0"
    

    Run npm install

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

    You could try changing webpack-dev-server to webpack serve in your npm run script inside package.json

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

    For some reason the webpack team changed the command to webpack serve Change your package.json:

    "start": "webpack serve"

    Ref: https://github.com/webpack/webpack-dev-server/issues/2759

    The version I am using:

    "webpack": "^5.10.0",
    "webpack-cli": "^4.2.0",
    "webpack-dev-server": "^3.11.0"
    
    0 讨论(0)
  • 2021-01-04 02:49

    This process work for me

    1 - Run your Command Invite/Terminal as Administrator

    2 - Install the Vue CLI globally with the command :

    npm install -g vue-cli
    

    3 - Create your vue project

    vue init webpack your_project_name_here
    

    4 - Goto your project directory you

    cd your_project_name_here
    

    5 - If you have vulnerabilities execute :

    npm audit fix
    

    Now you can start the web server in development mode by using npm in the following way:

    npm run dev
    

    By default it will start the server on port 8080

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

    I agree that you have to upgrade from webpack 3 to 4, but specifically these are the steps I had to do, first, because webpack-cli has been split out into a separate package:

    $ npm install webpack webpack-cli --save-dev
    

    As explained here: https://webpack.js.org/guides/getting-started/#basic-setup

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