Description
I am currently using React Native 0.76.9 and recently migrated from Node 18 to Node 20 due to some complexities in my project. I reproduced the same behavior mentioned in the issue.
After cleaning the project and running pod install --repo-update, even if the .xcode.env.local file had been deleted, it gets automatically regenerated. This file forces Xcode to use a local Node version (for example, Node 18 in my case).
So, when you are using a different Node version (like moving from 18 to 20 in my case) and launch the app, you encounter the following error:
error export CLANG_WARN_DOCUMENTATION_COMMENTS=YES error export CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER=NO error export GCC_WARN_UNDECLARED_SELECTOR=YES error export VALIDATE_PRODUCT=NO error Failed to build ios project. "xcodebuild" exited with error code '65'.
To fix this problem, here are two possible solutions:
Solution 1:
If you want to keep using Node 20 with a React Native version lower than 0.78, you can add a post-install script in your Podfile to automatically delete .xcode.env.local after each pod install. Then, run your app as usual, and it should work fine.
Solution 2:
The better long-term solution is to upgrade to React Native 0.78 or above. This version has much better support for Node 20, including fixes in scripts and internal dependencies like Hermes and node-gyp.
I hope this helps someone facing the same issue!
Steps to reproduce
- Use React Native 0.76.9 with Node 20 (recently upgraded from Node 18).
- Run pod install --repo-update in the ios folder.
- Open the project in Xcode or run react-native run-ios.
- Observe the build fails with error code 65 and logs mentioning .xcode.env.local forcing Node 18.
React Native Version
0.76.9
Affected Platforms
Runtime - iOS
Output of npx @react-native-community/cli info
react native 0.76.0
node 20
Stacktrace or Logs
`error export CLANG_WARN_DOCUMENTATION_COMMENTS=YES
error export CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER=NO
error export GCC_WARN_UNDECLARED_SELECTOR=YES
error export VALIDATE_PRODUCT=NO
error Failed to build ios project. "xcodebuild" exited with error code '65'.
MANDATORY Reproducer
#31259
Screenshots and Videos
No response
Description
I am currently using React Native 0.76.9 and recently migrated from Node 18 to Node 20 due to some complexities in my project. I reproduced the same behavior mentioned in the issue.
After cleaning the project and running pod install --repo-update, even if the .xcode.env.local file had been deleted, it gets automatically regenerated. This file forces Xcode to use a local Node version (for example, Node 18 in my case).
So, when you are using a different Node version (like moving from 18 to 20 in my case) and launch the app, you encounter the following error:
error export CLANG_WARN_DOCUMENTATION_COMMENTS=YES error export CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER=NO error export GCC_WARN_UNDECLARED_SELECTOR=YES error export VALIDATE_PRODUCT=NO error Failed to build ios project. "xcodebuild" exited with error code '65'.To fix this problem, here are two possible solutions:
Solution 1:
If you want to keep using Node 20 with a React Native version lower than 0.78, you can add a post-install script in your Podfile to automatically delete .xcode.env.local after each pod install. Then, run your app as usual, and it should work fine.
Solution 2:
The better long-term solution is to upgrade to React Native 0.78 or above. This version has much better support for Node 20, including fixes in scripts and internal dependencies like Hermes and node-gyp.
I hope this helps someone facing the same issue!
Steps to reproduce
React Native Version
0.76.9
Affected Platforms
Runtime - iOS
Output of
npx @react-native-community/cli infoStacktrace or Logs
MANDATORY Reproducer
#31259
Screenshots and Videos
No response