Administrator
Administrator
Published on 2025-05-27 / 3 Visits
0
0

第一步

安装Android Studio

开发不使用这个IDE,用它安装AVD、SDK、tools等

所需的版本会随着版本更新而不同,具体安装什么版本的sdk可以查看rn官网页面:https://reactnative.dev/docs/next/set-up-your-environment?os=windows

(在左上角找到对应版本)

安装Node.js

一般不会限制特定版本,安装最新的lts版本就可以。

可以考虑用https://wjhblog.cn/archives/nvm-windows来安装和管理node版本

安装JDK

https://reactnative.dev/docs/next/set-up-your-environment?os=windows中找到当前版本所需的JDK版本

然后用chocolatey安装jdk https://wjhblog.cn/archives/chocolatey-windowsbao-guan-li-gong-ju

使用expo初始化项目

重点:windows中不要把项目目录放在太深的层次中!!!不然在构建时会出问题!

在 Windows 平台上,Reanimated 在 CMakeLists 里会把 node_modules 的绝对路径(形如 C:/Users/…/node_modules/…)直接当做子目录来创建(ninja 就试图去 src/main/cpp/worklets/CMakeFiles/worklets.dir/C_/Users/… 这样一段带有冒号的路径)。由于 Windows 默认文件系统对路径长度和“冒号”“反斜杠/正斜杠”等格式的限制,导致 CMake/Ninja 无法正确创建这些目录,从而 build 失败。

内建模版文档:https://docs.expo.dev/more/create-expo/#--template

#初始化一个仅包含必须的依赖的项目,并且不启用ts
#默认的模版包含expo-router和ts等
npx create-expo-app --template expo-template-blank


Comment