You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React项目启动失败:babel-loader版本冲突及依赖缺失问题求助

Create React App依赖树冲突:babel-loader版本不兼容导致项目无法启动

我花了数小时尝试根据报错提示、视频及论坛内容解决问题。最初遇到fs、http、https模块缺失问题,使用npm install安装后无效,报错持续存在。目前项目出现依赖树问题:Create React App提供的react-scripts包依赖babel-loader@8.1.0,但检测到项目目录中存在版本为9.1.2的babel-loader,导致项目无法启动。

仓库地址:https://github.com/JonathanDaboush/employeeportal.git

详细报错信息

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 react-scripts package provided by Create React App requires a dependency:

  "babel-loader": "8.1.0"

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

  C:\Users\Jonathan\Documents\divinapopinam2frontendemployeeportal\node_modules\babel-loader (version: 9.1.2)  

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 project folder.
  2. Delete node_modules in your project folder.
  3. Remove "babel-loader" from dependencies and/or devDependencies in the package.json file in your project folder.
  4. Run npm install or yarn, depending on the package manager you use.

In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:

  5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
     This may help because npm has known issues with package hoisting which may get resolved in future versions.

  6. Check if C:\Users\Jonathan\Documents\divinapopinam2frontendemployeeportal\node_modules\babel-loader is outside your project directory.
     For example, you might have accidentally installed something in your home folder.

  7. Try running npm ls babel-loader in your project folder.
     This will tell you which other package (apart from the expected react-scripts) installed babel-loader.

If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That would permanently disable this preflight check in case you want to proceed anyway.        

P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!

PS C:\Users\Jonathan\Documents\divinapopinam2frontendemployeeportal> npm start

> divinapopinam2frontendemployeeportal@0.1.0 start
> react-scripts start


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 react-scripts package provided by Create React App requires a dependency:

  "babel-loader": "8.1.0"

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

  C:\Users\Jonathan\Documents\divinapopinam2frontendemployeeportal\node_modules\babel-loader (version: 9.1.2)

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 project folder.     
  2. Delete node_modules in your project folder.
  3. Remove "babel-loader" from dependencies and/or devDependencies in the package.json file in your project folder.
  4. Run npm install or yarn, depending on the package manager you use.

In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:

  5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
     This may help because npm has known issues with package hoisting which may get resolved in future versions.

  6. Check if C:\Users\Jonathan\Documents\divinapopinam2frontendemployeeportal\node_modules\babel-loader is outside your project directory.
     For example, you might have accidentally installed something in your home folder.

  7. Try running npm ls babel-loader in your project folder.
     This will tell you which other package (apart from the expected react-scripts) installed babel-loader.

If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That would permanently disable this preflight check in case you want to proceed anyway.        

P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!

解决建议

核心修复步骤(优先尝试)

  • 删除项目目录下的package-lock.json(注意不要删除package.json)和node_modules文件夹
  • 打开package.json,将babel-loader从dependencies或devDependencies字段中移除
  • 执行npm install重新安装所有依赖
  • 运行npm start尝试启动项目

进阶排查方案(核心步骤无效时)

  • 切换到yarn包管理器:安装yarn后,重复上述删除锁文件、node_modules、移除babel-loader依赖的步骤,然后执行yarn install再启动项目
  • 执行npm ls babel-loader命令,查看是哪个第三方包引入了高版本的babel-loader,针对该包进行版本调整或排除其babel-loader依赖
  • 若上述方法均无效,可在项目根目录创建.env文件,写入SKIP_PREFLIGHT_CHECK=true跳过版本检查(注意:此方法仅为临时规避,可能引发其他潜在兼容性问题)

内容的提问来源于stack exchange,提问作者jonathan Daboush

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.01 13:31:01