sentry-react-native: XCode Build Fails: PhaseScriptExecution failed with a nonzero exit code
OS:
- Windows
- MacOS
- Linux
Platform:
- iOS
- Android
SDK:
-
@sentry/react-native(>= 1.0.0) -
react-native-sentry(<= 0.43.2)
SDK version: 15.0.0
react-native version: 0.62.2
Are you using Expo?
- Yes
- No
Are you using sentry.io or on-premise?
- sentry.io (SaaS)
- on-premise
Configuration:
(@sentry/react-native)
Sentry.init({
dsn: 'https://...@sentry.io/...'
});
I have following issue:
Building an iOS App Sentry fails with: env: node: No such file or directory Command PhaseScriptExecution failed with a nonzero exit code
Executing /bin/sh -c /Users/{USERNAME}/Library/Developer/Xcode/DerivedData/{ID}/Build/Intermediates.noindex/{APP}.build/Release-iphoneos/{APP}.build/Script-00DD1BFF1BD5951E006B06BC.sh in on the console will throw the following error: line 5: ../node_modules/@sentry/cli/bin/sentry-cli: No such file or directory
Steps to reproduce:
Following the setup on https://docs.sentry.io/platforms/react-native/
- Step 1:
yarn add @sentry/react-native - Step 2:
yarn sentry-wizard -i reactNative -p ios android - Step 3:
cd ios && pod install - Setp 4: Setting up JS Error handling
Connecting the SDK to Sentry and verifying it in DEV Mode works fine.
In XCode:
- Step 5: Clean Build Folder
- Step 6: Build Configuration Release
- Step 7: Removing
localhostfromApp Transport Security Settings - Step 8: Run Build
Actual result:
Build fails env: node: No such file or directory Command PhaseScriptExecution failed with a nonzero exit code
Expected result:
Build runs successfully.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 12
- Comments: 26 (2 by maintainers)
sudo ln -s "$(which node)" /usr/local/bin/nodeThis is made my xcode see the node.
@karlludwigweise I found fixes for my issue.
watchman watch-del-all && rm -rf node_modules/ && rm -rf /tmp/metro-bundler-cache-* && rm -rf /tmp/haste-map-react-native-packager-* && yarn && cd ios && rm -rf Pods && rm -rf Podfile.lock && pod install && cd ../remove derivedData, clean build.
build phases Upload Debug Symbols to Sentry =>
Bundle React Native code and images =>
I hope it helps You to.
I was using nvm and non of solutions worked for me
So looking in docs I found this solution: https://docs.sentry.io/clients/react-native/manual-setup/#using-node-with-nvm-or-notion
Basically I set the scripts like this
Bundle React Native code and images
Upload Debug Symbols to Sentry
Very good and clean solution. Worked
I am working on an ejected Expo App in the bare workflow and applied the first part of @sprotymo solution and it works! Thanks!
In
build phasesI changed theUpload Debug Symbols to Sentryscript to match the one he describes. I also had the lineexport SENTRY_PROPERTIES=sentry.propertiesin my original script, so it eventually looked like this:I don’t have a
Bundle React Native code and imagesscript inbuild phasesso I didn’t add it.@sprotymo - this guys solution worked for me. though i didnt have to clean adn reinstall everything I had to add the following scripts to the beginning of the Build Phase sections called
Note append the above to the beginning of those sections - before the existing script that must already be present in those sections.
I am guessing the issue is with using nvm. scripts added by sentry wizard are not able to locate node binaries when you use nvm
It worked for me. I am using Mac Mini with M1 chipset
Facing this same issue in my CLI.
The following build commands failed: PhaseScriptExecution Bundle\ React\ Native\ code\ and\ images /Users/runner/Library/Developer/Xcode/DerivedData/Project/Build/Intermediates.noindex/ArchiveIntermediates/Project/IntermediateBuildFilesPath/Project.build/Release-iphoneos/Project.build/Script-00DD1BFF1BD5951E006B06BC.sh (in target 'Project' from project 'Project') (1 failure) ##[error]Error: /usr/bin/xcodebuild failed with return code: 65xcode 12 react-native@0.6.32 sentry/react-native@2.4.0
Took a few hours to debug, finally got it working with the following scripts:
Bundle React Native code and images
Upload Debug Symbols to Sentry
Hope these help guys!
I would throw in a missing documentation on https://docs.sentry.io/platforms/react-native/ but otherwise I’m good with closing it. 👍
found by chance, in the link to the official documentation and possible problems with nvm
Hi guys, looks like everything is solved, are we good to close this?