Introduction
After building a native mobile app in Mendix Studio Pro and opening the Android project in Android Studio, the following build failure error occurs:
A problem occurred starting process 'command 'node''
Cause: error=2, No such file or directorThis error occurs because the Gradle build process cannot locate the Node.js executable in the system PATH. This error occurs when Android Studio's command-line tools are not properly configured or when the PATH environment variable is not accessible to Android Studio's build process.
Environment
Native Mobile
Instructions/Procedure
To resolve this error, configure the Android Studio command-line launcher and PATH variable as follows:
- In Android Studio, navigate to Tools > Create Command-line Launcher
- Confirm the creation when prompted
- Open the terminal
- Add the Android Studio path to the PATH variable by editing the shell configuration file. There are a few options on how to set it:
For zsh (default on macOS)
echo 'export PATH="/Applications/Android Studio.app/Contents/MacOS:$PATH"' >> ~/.zshrc source ~/.zshrcFor bash (for Mac):
echo 'export PATH="/Applications/Android Studio.app/Contents/MacOS:$PATH"' >> ~/.bash_profile source ~/.bash_profileUsing PowerShell (for Windows):
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Program Files\Android\Android Studio\bin", [EnvironmentVariableTarget]::User)Using Command Prompt (for Windows)
setx PATH "%PATH%;C:\Program Files\Android\Android Studio\bin"
Verify the PATH was updated:
echo $PATHIn the terminal, navigate to the Android project directory:
cd /path/to/[LocalBuildFolder]/androidLaunch Android Studio from the terminal:
studio .- Once Android Studio opens with your project, go to Build > Clean Project
- After cleaning completes, go to Build > Rebuild Project
The build should now complete successfully without the Node.js path error.
Outcome
After following the steps, Android Studio can successfully locate the Node.js executable and the Gradle build process completes without PATH-related errors. Future builds will work correctly as the PATH variable is permanently updated.
Internal information related
Not applicable
Additional information
Not applicable
0 Comments