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

今配置一个webpack-dev-server进行服务端渲染时老是不正确

npm run dev 就崩了
在这里插入图片描述
起初的配置为

  "devDependencies": {
    "webpack": "^5.1.3"
    "webpack-dev-server": "^3.11.0"
  }

 

查了些资料都说是 webpack3.x的版本与webpack-dev-server3.x的版本不兼容。我就想我改

"webpack-dev-server": "^2.9.7" 事实证明不行,最后只得把webpack版本也同着改了才对

  "devDependencies": {
    "webpack": "^3.4.1"
     "webpack-dev-server": "^2.9.7"
  }

 

看来还不能乱配对哟

posted @ 2020-10-21 20:58  奔跑的痕迹  阅读(186)  评论(0编辑  收藏  举报