欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

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

程序员文章站 2022-07-12 19:34:00
...

本问题解决方法来自于网友

问题描述
{
  "name": "demo",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "webpack-dev-server --open webpack --config webpack.config.js",
    "build": "webpack --config webpack.config.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@babel/core": "^7.12.3",
    "babel-loader": "^8.1.0",
    "clean-webpack-plugin": "^3.0.0",
    "css-loader": "^5.0.0",
    "html-webpack-plugin": "^4.5.0",
    "vue": "^2.6.12",
    "vue-loader": "^15.9.4",
    "vue-style-loader": "^4.1.2",
    "vue-template-compiler": "^2.6.12",
    "webpack": "^5.3.0",
    "webpack-cli": "^4.1.0",
    "webpack-dev-server": "^3.11.0"
  }
}

npm run build,ok;
npm run start,不ok,报错如下:
Error: Cannot find module ‘webpack-cli/bin/config-yargs’

解决方法

卸载webpack-cli^4.1.0,安装webpack-cli 3.*,比如[email protected]

npm uninstall --save-dev webpack-cli
npm install --save-dev [email protected]
相关标签: webpack