init-windows fails silently with "unknown command" when pwsh.exe is missing; not documented in rnw-dependencies
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- node.js, powershell, react-native
- 領域
- cli, documentation, tooling
調査の方向性
npx react-native init-windows --overwrite で失敗を再現し、その後 react-native-windows/react-native.config.js と @react-native-windows/find-dotnet-tools の読み込み経路を調べます。rnw-dependencies ページとパッケージ依存関係のメタデータを確認し、不足している PowerShell および runtime-package の要件を確認します。選択した修正を、報告されている 0.81.x および 0.83.x の挙動に対して検証できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Problem Description
On a fresh project, npx react-native init-windows --overwrite fails with:
error: unknown command 'init-windows'
The actual root cause is that react-native-windows's plugin throws at module-load time inside @react-native-windows/find-dotnet-tools when pwsh.exe is not on PATH:
Unable to find pwsh.exe. It should have been made available by `yarn install`.
The community CLI silently swallows the throw during plugin discovery, drops the command, and reports "unknown command" instead of the real error.
PowerShell 7 is not listed on the rnw-dependencies page. Windows ships only Windows PowerShell 5.1 by default, so most fresh machines fail this check.
This affects both [email protected] and 0.83.x. Additionally, the 0.83.x line has a missing-dependency bug: @react-native-windows/find-dotnet-tools is not in any package's dependencies but is required at runtime. Even after installing pwsh, init-windows still fails on 0.83.x until the user runs yarn add @react-native-windows/find-dotnet-tools manually.
Steps To Reproduce
On a clean Windows 11 install without pwsh.exe on PATH:
npx --yes @react-native-community/cli@latest init Test --version 0.83-stablecd Test && yarn add react-native-windows@^0.83.0npx react-native init-windows --overwrite
Result: error: unknown command 'init-windows'
To see the real underlying error, run:
node -e "require('react-native-windows/react-native.config.js')"
`Unable to find pwsh.exe. It should have been made available by yarn install.`
Expected Results
Either:
init-windowsplugin discovery is resilient to missing pwsh: defer the pwsh check until the command actually runs, so the user sees a clear "install PowerShell 7" message instead of "unknown command".- PowerShell 7 is documented as a prerequisite on the rnw-dependencies page, so users install it before reaching this step.
@react-native-windows/find-dotnet-toolsis added toreact-native-windows's (or@react-native-windows/cli's)dependenciesso it's installed transitively rather than left as a manualyarn add.
Ideally all three.
CLI version
20.0.0
Environment
System:
OS: Windows 11 10.0.26200
CPU: (20) x64 13th Gen Intel(R) Core(TM) i9-13900H
Memory: 39.55 GB / 63.45 GB
Binaries:
Node:
version: 22.23.0
path: C:\Program Files\nodejs\node.EXE
Yarn:
version: 1.22.22
path: C:\Program Files\nodejs\yarn.CMD
npm:
version: 10.9.8
path: C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK:
AllowDevelopmentWithoutDevLicense: Enabled
AllowAllTrustedApps: Enabled
Versions:
- 10.0.19041.0
- 10.0.22621.0
- 10.0.26100.0
IDEs:
Android Studio: AI-243.24978.46.2431.13363775
Visual Studio:
- 17.14.36401.2 (Visual Studio Enterprise 2022)
Languages:
Java:
version: 17.0.13
path: C:\Program Files\Eclipse Adoptium\jdk-17.0.13.11-hotspot\bin\javac.EXE
Ruby: Not Found
npmPackages:
"@react-native-community/cli":
installed: 20.0.0
wanted: 20.0.0
react:
installed: 19.1.4
wanted: 19.1.4
react-native:
installed: 0.81.6
wanted: 0.81.6
react-native-windows:
installed: 0.81.29
wanted: ~0.81.6
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Community Modules
None
Target React Native Architecture
Old Architecture (UWP) Only
Target Platform Version
10.0.22621
Visual Studio Version
None
Build Configuration
None
Snack, code example, screenshot, or link to a repository
No response
- 主要言語
- C++
- スター
- 17.4k
- フォーク
- 1.2k
- 平均マージ
- 2日 20時間
- マージ済み PR(30日)
- 15
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/react-native-windows のほかの issue
-
Fabric text is drawn with ClearType onto transparent composition surfaces, fringing thin glyphsオープンNeeds: Triage :mag:
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
microsoft/react-native-windows#16340 ·
メンテナーはふだん 2 日以内に返信
-
bug Needs: Triage :mag:
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
microsoft/react-native-windows#16321 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
bug Needs: Triage :mag:
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
microsoft/react-native-windows#16479 ·
メンテナーはふだん 2 日以内に返信
-
Needs: Triage :mag:
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
microsoft/react-native-windows#16442 · コメント 2 件 ·
メンテナーはふだん 2 日以内に返信
-
Fabric: activating the window doesn't announce the window or the focused control to a screen readerオープンNeeds: Triage :mag:
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
microsoft/react-native-windows#16435 ·
メンテナーはふだん 2 日以内に返信
microsoft/react-native-windows の issue をすべて見る
似ている issue
-
The Outdated Version prompt shows the release tag as unescaped HTML対応中かも @on8st が今日担当しました。 オープンbug good first issue GUI maintainer-review priority: low
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
aethersdr/AetherSDR#6405 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
bitcoin-core/gui-qml#1003 ·
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 63/100
metasequoiaime/msime#7328 ·
メンテナーはふだん 1 日以内に返信
-
[Linux] --calibrate combined with --model silently falls through to plain re-setup (setup.py:4958)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信