I'm working on a React Native project and recently encountered an issue with building my app in Android Studio. After updating to the newest RN version, I switched to using nvm instead of nodejs to be more flexible with older apps. But somehow I get this error:
java.io.IOException: Cannot run program "node" (in directory "/path/to/my/project"): error=2, No such file or directory
I have installed Node.js v20.11.0 using nvm. Running node -v
in the terminal correctly shows v20.11.0.
This issue persists even after setting the PATH environment variable to include the Node.js binary path in my .bashrc
file.
nvm
and setting it as the default version..bashrc
.Despite these efforts, the build process in Android Studio still fails to recognize the correct Node.js version.
How can I configure Android Studio to recognize the Node.js version installed via nvm
? Are there any specific settings or configurations in Android Studio that I need to adjust to ensure it uses the correct Node.js version during the build process?
Ok, as proposed in this threat, creating a symbolic link to the used nvm version fixes thee problem. The issue is that when using nvm, Android Studio does not where to find the node executable.
sudo ln -s "$(which node)" /usr/local/bin/node