React npm start启动webpack报错问题

在使用Create React App创建的项目中遇到`npm start`启动时webpack版本冲突的报错,错误信息提示高版本webpack可能导致问题。解决方法包括删除`package-lock.json`或`yarn.lock`、清理`node_modules`、移除`webpack`依赖并重新安装,或者通过设置`.env`文件禁用预检查。但作者实践发现,这些常规解决方案无效,实际有效的办法是卸载本地4.4.3版本webpack,安装4.4.2版本以匹配react-scripts的要求。
摘要由CSDN通过智能技术生成

报错信息

There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.

The rea ct-scripts package provided by Create React App requires a dependency:

  "webpack": "4.42.0"

Don't try to install it manually: your package manager does it automatically.
However, a different version of webpack was detected higher up in the tree:

  C:\xxxxxxxx\webpack (version: 4.43.0)

Manually installing incompatible versions is known to cause hard-to-debug issues.

If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That will permanently disable this message but you might encounter other issues.

To fix the dependency tree, try following the steps below in the exact order:

  1. Delete package-lock.json (not package.json!) and/or yarn.lock in your pro

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值