Error: Cannot find module 'C:\Users\ky\Desktop\gshop-main\hello-vue\node_modules\webpack-dev-server\bin\webpack-dev-server.js'
时间: 2023-09-02 11:11:30 浏览: 118
根据引用、和的内容,你遇到的错误是由于webpack与webpack-dev-server版本不兼容导致的。解决这个问题的方法有以下几种:
1. 卸载现有的webpack-dev-server,并安装老版本的webpack-dev-server:
- 执行命令:npm uninstall webpack-dev-server
- 执行命令:npm i webpack-dev-server@3.11.0
2. 确保webpack-cli和webpack-dev-server的版本都是3.x.x:
- 执行命令:npm uninstall webpack-cli -D
- 执行命令:npm i webpack-cli@3.3.12 -D
3. 强制卸载现有的webpack,并安装老版本的webpack:
- 执行命令:npm uninstall webpack --force
- 执行命令:npm i webpack@3.11.0 --force
4. 运行项目:
- 执行命令:npm run dev
另外,你还可以尝试使用cnpm来安装依赖和运行项目。首先安装cnpm:
- 执行命令:npm install -g cnpm --registry=https://registry.npm.taobao.org
然后使用cnpm来安装和运行项目:
- 执行命令:cnpm install
- 执行命令:cnpm run dev
请注意,以上方法都是根据引用内容提供的解决方案,可能因具体情况而有所差异。建议你根据自己的项目和依赖情况选择适合的方法进行尝试解决。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [gshop@1.0.0 dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js的解决...](https://blog.csdn.net/qq_52359462/article/details/115699153)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [npm run dev运行时报错出现foms-client@1.0.0 dev: `webpack-dev-server --inline --progress --config ...](https://blog.csdn.net/qq_46687516/article/details/124498382)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文