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

React应用渲染时出现eslint加载react-app配置失败错误求助

解决ESLint无法加载"react-app"配置的问题

问题根源

你在devDependencies里安装了错误的包eslint-config-react,而Create React App所需的react-app ESLint配置是由react-scripts内置提供的,不需要额外安装第三方的React ESLint配置包,这个多余的包会导致ESLint解析时出现混淆,从而抛出加载失败的错误。

解决步骤

  • 卸载错误的依赖包:
    npm uninstall eslint-config-react
    # 如果你用Yarn的话:
    # yarn remove eslint-config-react
    
  • 清理依赖缓存(推荐执行,避免残留问题):
    npm cache clean --force
    # Yarn用户执行:
    # yarn cache clean
    
  • 重新安装所有依赖:
    npm install
    # Yarn用户执行:
    # yarn install
    
  • 重启开发服务器:关闭当前运行的npm start进程,重新执行npm start启动应用

补充说明

你的package.json里的eslintConfig配置是完全正确的,extends: ["react-app", "react-app/jest"]是Create React App的标准配置,不需要做任何修改。

内容的提问来源于stack exchange,提问作者Kasun Jayasanka

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.13 09:50:09