A New Collection of Thoughtful Learning Apps — Now Available on iOS & Android

Image
I’m excited to share a set of mobile apps I’ve recently completed and published on both the Google Play Store and the Apple App Store. These apps are designed with a simple goal in mind: to make meaningful, structured content more accessible, whether you’re studying theology or improving your English vocabulary. 📱 Now Available on Both Platforms All apps are live and available for download: Google Play Developer Page: https://play.google.com/store/apps/dev?id=5835943159853189043 Apple App Store Developer Page: https://apps.apple.com/ca/developer/q-z-l-corp/id1888794100 📖 Theology & Confession Study Apps For those interested in Reformed theology and classical Christian teachings, I’ve developed a series of apps that present foundational texts in a clean, focused reading format: The Belgic Confession Canons of Dort Heidelberg Catechism Westminster Shorter Catechism Each app is designed to provide a distraction-free experience, making it easier to read, reflect, and revisit these im...

解决 Android Studio 中 React Native “A problem occurred starting process 'command node'” 错误

解决 Android Studio 中 React Native “A problem occurred starting process 'command node'” 错误


如果您在构建 React Native Android 项目时遇到以下 Gradle 同步错误:

A problem occurred evaluating project ':react-native-svg'.
> A problem occurred starting process 'command 'node''

即使您在终端中能够正常运行 node 命令,也无法在 Android Studio 中构建成功,本文将帮您快速解决该问题。

常见误区

此错误通常被误认为是 Node.js 或 PATH 配置问题,但实际情况并非如此。

  • Node.js 已安装并且在终端正常运行。
  • PATH 和环境变量配置正确。
  • 但是 Android Studio 的 Gradle 同步仍然失败。

真正的原因

该问题通常是因为 Android Studio 中 Gradle 使用的 JDK 配置不正确。Gradle 运行在 JVM 上,并通过 JVM 启动外部进程(例如 node)。

如果 Gradle JDK 版本不兼容或配置错误,Gradle 将无法启动这些进程,从而导致该错误,即使系统中 Node.js 正常安装。

解决方案

请按照以下步骤修复:

  1. 打开 Android Studio 的 设置(macOS 下为 Preferences)。
  2. 导航到:Build, Execution, Deployment > Build Tools > Gradle
  3. Gradle JDK 中,避免选择默认的 JetBrains Runtime 或内置选项。
  4. 选择手动安装的 JDK,推荐使用类似 Azul Zulu JDK 17 的版本,且要与您的系统架构(如 Apple Silicon 的 aarch64)匹配。
  5. 保存并重新同步项目。

这样做能保证 Gradle 正确启动 Node 和其他进程,解决构建失败问题。

macOS 其他实用选项

1. 通过终端启动 Android Studio,继承 shell 环境变量

macOS 用户如果通过 Dock 或 Spotlight 启动 Android Studio,可能无法继承 shell 环境变量(如 PATH)。可以在终端运行:

open -a "Android Studio"

这样可以让 Android Studio 继承终端的环境变量,解决路径相关的问题。

2. 设置 STUDIO_GRADLE_JDK 环境变量

您也可以通过设置环境变量 STUDIO_GRADLE_JDK 来全局指定 Gradle 使用的 JDK,例如:

export STUDIO_GRADLE_JDK=$JAVA_HOME

将该命令添加到您的 ~/.zshrc~/.bash_profile,然后重新启动终端和 Android Studio。

总结

  • Gradle JDK 配置错误是导致该“node”命令错误的主要原因
  • 在 Android Studio 中手动选择兼容的 JDK(如 Azul Zulu、Temurin)即可解决。
  • macOS 用户可通过终端启动 Android Studio 或设置 STUDIO_GRADLE_JDK 环境变量辅助修复。
  • 详细信息请参阅 相关 GitHub 讨论

按照以上方法,您将能顺利构建 React Native Android 项目,避免“node”命令找不到的烦恼。

❤️ Support This Blog


If this post helped you, you can support my writing with a small donation. Thank you for reading.


Comments

Popular Posts

Fix “A problem occurred starting process 'command node'” in Android Studio for React Native

Fix up watchman issue with Ghost

Using Mutual TLS (mTLS) in Next.js (Server-Side Only)