Fix “A problem occurred starting process 'command node'” in Android Studio for React Native
Fix “A problem occurred starting process 'command node'” in Android Studio for React Native
If you are building a React Native Android project and encounter this error during Gradle sync:
A problem occurred evaluating project ':react-native-svg'. > A problem occurred starting process 'command 'node''
—even though node works perfectly in your terminal—this guide will show you how to fix it quickly.
Common Misconceptions
This error is often mistaken as a Node.js or PATH issue, but that is not always the case.
- Node.js is installed and working in your terminal.
- PATH and environment variables appear correct.
- Still, Android Studio Gradle sync fails with the above error.
The Real Cause
The issue typically arises because of an incorrect Gradle JDK configuration inside Android Studio. Gradle runs inside a JVM and uses that JVM to spawn external processes (like node).
If the Gradle JDK is incompatible or misconfigured, Gradle will fail to spawn processes, causing the error message, even if node is installed correctly.
The Fix That Worked
Follow these steps to resolve the problem:
- Open Android Studio Settings (or Preferences on Mac).
- Navigate to: Build, Execution, Deployment > Build Tools > Gradle
- Under Gradle JDK, avoid using the default JetBrains Runtime or embedded options.
- Select a manually installed JDK, preferably something like Azul Zulu JDK 17 matching your system architecture (e.g., aarch64 for Apple Silicon).
- Apply changes and sync your project again.
This simple change fixes the issue by ensuring Gradle can correctly spawn Node and other processes during builds.
Other Useful Options (Especially on macOS)
1. Launch Android Studio from Terminal to inherit shell environment
If you encounter this issue on a Mac, sometimes launching Android Studio via the Dock or Spotlight does not load your shell environment variables (like PATH). Open a terminal and run:
open -a "Android Studio"
This makes Android Studio inherit your terminal’s environment, which can fix many path-related issues.
2. Set the STUDIO_GRADLE_JDK environment variable
To globally fix Gradle JDK issues for Android Studio, you can export the environment variable STUDIO_GRADLE_JDK to point to your desired JDK, for example:
export STUDIO_GRADLE_JDK=$JAVA_HOME
Add this line to your ~/.zshrc or ~/.bash_profile so it is available system-wide before launching Android Studio.
Summary
- Incorrect Gradle JDK selection is the most common root cause of the ‘node’ command error in Android Studio Gradle builds.
- Manually select a compatible JDK (Azul Zulu, Temurin, etc.) inside Android Studio Gradle settings.
- On macOS, launching Android Studio from the terminal or setting
STUDIO_GRADLE_JDKcan help. - Check the related GitHub issue for more details.
With this fix, you should be able to build your React Native Android project without the frustrating node error.
❤️ Support This Blog
If this post helped you, you can support my writing with a small donation. Thank you for reading.
Comments
Post a Comment