Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

On the nightly, @react-native-community/cli 20 finds no platforms or commands, with no warning that it needs CLI 21

未关闭 适合新手
#59,694 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
88/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
javascript, node.js, react-native

调研方向

从 packages/community-cli-plugin/package.json 开始,具体是 @react-native-community/cli 的 peerDependencies 条目,issue 在 46-49 行链接了它。修改该范围,使其指定 CLI 21 或更新版本,即能够读取 #58670 和 #58671 中移动的配置的版本。用链接的复现步骤检查结果:安装 CLI 20.2.0 后,yarn install 现在应发出警告,而 CLI 21.0.0-alpha.1 仍应满足 peer 范围。完成意味着 peer 范围反映了兼容的 CLI 版本,且不改变插件的运行时代码。

由索引模型根据 Issue 内容生成。

描述

Description

On 0.89.0-nightly-20261030-4afc5d5b9, an app that still has @react-native-community/cli 20.2.0, the version the reproducer template and every 0.88 app ship, gets no platforms and no commands from the CLI, and nothing says why: yarn android fails with error: unknown command 'run-android', npx react-native config prints "platforms": {} and "project": {}, and Gradle's :app:generateAutolinkingPackageList fails with Could not find project.android.packageName in react-native config output!. With @react-native-community/cli 21.0.0-alpha.1, the same app's config has the Android and iOS platforms and packageName: com.reproducerapp.

The platform config moved out of react-native in b26baaeba026f34963656a8daec7f5f494253160 (#58670) and be9fbdd0d59ffd88992f16523b5fbfe9db709e6a (#58671), so CLI 20 no longer finds it. @react-native/community-cli-plugin still declares "@react-native-community/cli": "*" as its peer (package.json), so the install accepts CLI 20 without a warning. I'd expect the peer range to name the CLI versions that can read the new config, so the install points at the fix.

Steps to reproduce
  1. Clone https://github.com/YevheniiKotyrlo/rn-nightly-cli-20-no-platforms. It is the reproducer template with react-native and every @react-native/* package moved to 0.89.0-nightly-20261030-4afc5d5b9, and @react-native-community/cli left at 20.2.0.
  2. In ReproducerApp, run yarn install. It finishes with no warning about @react-native-community/cli.
  3. Run yarn android. Expected: the app builds. Actual: error: unknown command 'run-android'.
  4. Run npx react-native config. Expected: the Android and iOS platforms and the Android project. Actual: "commands": [], "platforms": {} and "project": {}, exit 0.
  5. In ReproducerApp/android, run ./gradlew :app:generateAutolinkingPackageList. Expected: the package list. Actual: the failure below.

With npx @react-native-community/[email protected] config in step 4, the config lists both platforms and "packageName": "com.reproducerapp".

React Native Version

0.89.0-nightly-20261030-4afc5d5b9

Affected Platforms

Build - Windows

Output of npx @react-native-community/cli info
System:
  OS: Windows 11 10.0.26300
  CPU: "(32) x64 AMD Ryzen 9 9950X3D 16-Core Processor          "
  Memory: 142.01 GB / 255.67 GB
Binaries:
  Node:
    version: 26.12.1
    path: C:\Program Files\nodejs\node.EXE
  Yarn:
    version: 1.22.22
    path: C:\Users\yevhe.YEVHENII\AppData\Roaming\npm\yarn.CMD
  npm:
    version: 12.2.1
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK:
    API Levels:
      - "33"
      - "35"
      - "35"
      - "35"
      - "36"
      - "37"
      - "37"
    Build Tools:
      - 35.0.0
      - 36.0.0
      - 36.1.0
      - 37.0.0
    System Images:
      - android-26 | Google APIs Intel x86_64 Atom
      - android-28 | Google APIs Intel x86_64 Atom
      - android-29 | Google APIs Intel x86_64 Atom
      - android-30 | Google APIs Intel x86_64 Atom
      - android-31 | Google APIs Intel x86_64 Atom
      - android-32 | Google APIs Intel x86_64 Atom
      - android-33 | Google APIs Intel x86_64 Atom
      - android-34 | Google APIs Intel x86_64 Atom
      - android-35 | Google APIs Intel x86_64 Atom
      - android-36.1 | Google Play Intel x86_64 Atom
      - android-36.1 | Pre-Release 16 KB Page Size Google Play Intel x86_64 Atom
      - android-37.0 | Google APIs Intel x86_64 Atom
    Android NDK: Not Found
  Windows SDK: Not Found
IDEs:
  Android Studio: AI-262.9437.185.2621.16467767
  Visual Studio: Not Found
Languages:
  Java:
    version: 17.0.20.1
    path: C:\Program Files\Microsoft\jdk-17.0.20.101-hotspot\bin\javac.EXE
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli":
    installed: 20.2.0
    wanted: 20.2.0
  react:
    installed: 19.3.0
    wanted: 19.3.0
  react-native:
    installed: 0.89.0-nightly-20261030-4afc5d5b9
    wanted: 0.89.0-nightly-20261030-4afc5d5b9
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found
Stacktrace or Logs
> npx react-native config
{
  "root": "D:\\work\\contributions\\rn-nightly-cli-20-no-platforms\\ReproducerApp",
  "reactNativePath": "D:\\work\\contributions\\rn-nightly-cli-20-no-platforms\\ReproducerApp\\node_modules\\react-native",
  "reactNativeVersion": "0.89",
  "dependencies": {},
  "commands": [],
  "healthChecks": [],
  "platforms": {},
  "assets": [],
  "project": {}
}

> ./gradlew :app:generateAutolinkingPackageList
> Task :app:generateAutolinkingPackageList FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:generateAutolinkingPackageList'.
> RNGP - Autolinking: Could not find project.android.packageName in react-native config output! Could not autolink packages without this field.
MANDATORY Reproducer

https://github.com/YevheniiKotyrlo/rn-nightly-cli-20-no-platforms

Screenshots and Videos

No response

主要语言
C++
星标
127k
派生
25.4k
平均合并
2 天 1 小时
30 天内合并 PR
67

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

react/react-native 的其他 Issue

查看 react/react-native 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。