【问题标题】:After creating a React app with yarn dlx create-react-app, the first time I press yarn start to start it, I get an error使用 yarn dlx create-react-app 创建 React 应用程序后,第一次按 yarn start 启动它时,出现错误
【发布时间】:2021-05-29 16:59:25
【问题描述】:

使用纱线 2 (yarnpkg/berry)

  • 在终端中
% yarn set version berry
% yarn dlx create-react-app apple
% cd apple
% yarn start
  • 在浏览器中
Failed to compile
Failed to load config "react-app" to extend from.
Referenced from: D:\Projects\apple\package.json
This error occurred during the build time and cannot be dismissed.

我该如何解决这个问题?

ps。 yarn dlx create-next-app 工作正常。只有CRA有问题

【问题讨论】:

    标签: reactjs create-react-app zsh yarnpkg yarn-v2


    【解决方案1】:

    yarn start 添加步骤yarn add eslint-create-react-app 之前为我解决了这个问题

    【讨论】:

    • 这不是一个实际的答案。答案应包含对实际问题的解释以及对答案的解释。您发布的内容最适合发表评论。请阅读:stackoverflow.com/help/how-to-answer
    【解决方案2】:

    create-react-app 目前已经包含 eslint-config-react-app。所以添加导致冲突

    Plugin "react" was conflicted between "package.json » eslint-config-react-app » C:\Users\bhalb\programming\activity-tracker\.yarn\__virtual__\eslint-config-react-app-virtual-8e12459b5a\0\cache\eslint-config-react-app-npm-7.0.0-1ad319c3be-dac130cfcb.zip\node_modules\eslint-config-react-app\base.js" and "BaseConfig » C:\Users\bhalb\programming\activity-tracker\.yarn\__virtual__\eslint-config-react-app-virtual-6f6769fb06\0\cache\eslint-config-react-app-npm-7.0.0-1ad319c3be-dac130cfcb.zip\node_modules\eslint-config-react-app\base.js".
    

    我的解决方案是通过在.yarnrc.yml 中设置nodeLinker: node-modules 来禁用即插即用

    【讨论】:

      猜你喜欢
      • 2019-03-09
      • 2020-01-21
      • 1970-01-01
      • 2018-03-19
      • 2018-12-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-10
      相关资源
      最近更新 更多