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

React Native Windows安装报错:找不到react-native-windows@latest版本

解决react-native-windows-init报错:No version of react-native-windows@latest found

问题重现

执行命令 npx react-native-windows-init --overwrite 时触发如下错误:

NoLatestReactNativeWindows: Error: No version of react-native-windows@latest found
at getLatestRNWVersion (C:\Users\XXXX\AppData\Local\npm-cache\_npx\966c6a96be6f5a32\node_modules\react-native-windows-init\src\Cli.ts:249:11)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at Object.reactNativeWindowsInit (C:\Users\XXXX\AppData\Local\npm-cache\_npx\966c6a96be6f5a32\node_modules\react-native-windows-init\src\Cli.ts:533:36) {
type: 'NoLatestReactNativeWindows',
data: undefined
}

解决方案

1. 指定具体版本执行初始化

latest 标签可能存在版本同步延迟,直接指定与本地react-native版本匹配的react-native-windows版本:

  • 先查看本地react-native版本:
    npm list react-native
    
  • 执行初始化时指定对应版本(示例为0.72.0,替换为你匹配的版本):
    npx react-native-windows-init --overwrite --version 0.72.0
    
    注意:react-native与react-native-windows版本需严格对应,选择完全匹配的版本号。

2. 清理npm缓存后重试

缓存异常可能导致版本检测失败,清理缓存后重新执行命令:

npm cache clean --force
npx react-native-windows-init --overwrite

3. 指定稳定版的react-native-windows-init

若当前init工具版本存在bug,指定已知稳定的版本执行:

npx react-native-windows-init@0.72.0 --overwrite

4. 手动安装依赖后初始化

先手动安装react-native-windows,再跳过安装步骤执行初始化:

  • 安装对应版本的依赖:
    npm install react-native-windows@<你的匹配版本> --save
    
  • 执行初始化并跳过安装:
    npx react-native-windows-init --overwrite --no-install
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.01 19:06:18