sentry-react-native icon indicating copy to clipboard operation
sentry-react-native copied to clipboard

Build fails on Xcode. Run custom shell script 'Bundle React Native code and images'

Open khagesh opened this issue 9 years ago • 32 comments

After I added sentry I am getting this error while building project.

PhaseScriptExecution Bundle\ React\ Native\ code\ and\ images /Users/khagesh/Library/Developer/Xcode/DerivedData/CP-awyselqwjoqrjfeypmvugdxlaeoa/Build/Intermediates/CP.build/Debug-iphonesimulator/CP.build/Script-00DD1BFF1BD5951E006B06BC.sh
export ...
.........
/bin/sh -c /Users/khagesh/Library/Developer/Xcode/DerivedData/CP-awyselqwjoqrjfeypmvugdxlaeoa/Build/Intermediates/CP.build/Debug-iphonesimulator/CP.build/Script-00DD1BFF1BD5951E006B06BC.sh

env: node: No such file or directory

react-native: 0.44 react-native-sentry: 0.14.3 Xcode version: 8.3.3

I am using bitcode, but I don't think it should fail build.

I believe I followed all steps correctly of setting up sentry and checked sentry.properties file which has all things that are needed. Any help will be much appreciated. Thanks!

khagesh avatar Jul 07 '17 08:07 khagesh

For me I had to remove react-native-sentry by using react-native unlink react-native-sentry and following the uninstallation process. Then I also removed the dependency from my package.json and ran rm -rf node_modules && yarn.

Next I had to remove references to Sentry in my index.ios.js and app.js files, as well as all the references in my AppDelegate.m.

In the build phases of my project target I removed this line from "Bundle React Native code and images": ../node_modules/@sentry/cli/bin/sentry-cli react-native xcode and I also deleted the "Upload Debug Symbols to Sentry" section.

After building the project it was able to run again, so I re-added the Sentry package and went through the installation process with:

yarn add react-native-sentry react-native link react-native-sentry

And it is now working, hope this helps!

asleepace avatar Jan 15 '18 22:01 asleepace

I'm upgrading from a pretty old version of Sentry and got it working by changing the path from /sentry-cli-binary/ to /@sentry/cli/ in project.pbxproj:

- shellScript = "export SENTRY_PROPERTIES=sentry.properties\nexport NODE_BINARY=node\n../node_modules/sentry-cli-binary/bin/sentry-cli react-native xcode ../node_modules/react-native/packager/react-native-xcode.sh";
+ shellScript = "export NODE_BINARY=node\n../node_modules/@sentry/cli/bin/sentry-cli react-native xcode ../node_modules/react-native/scripts/react-native-xcode.sh";

robvolk avatar Feb 25 '18 05:02 robvolk

I ran into this after having updated node and realized (after way too long) that the run script was pointing to a node binary that no longer existed on my system 😂

miwillhite avatar Aug 27 '19 10:08 miwillhite

I'm upgrading from a pretty old version of Sentry and got it working by changing the path from /sentry-cli-binary/ to /@sentry/cli/ in project.pbxproj:

- shellScript = "export SENTRY_PROPERTIES=sentry.properties\nexport NODE_BINARY=node\n../node_modules/sentry-cli-binary/bin/sentry-cli react-native xcode ../node_modules/react-native/packager/react-native-xcode.sh";
+ shellScript = "export NODE_BINARY=node\n../node_modules/@sentry/cli/bin/sentry-cli react-native xcode ../node_modules/react-native/scripts/react-native-xcode.sh";

If you take this solution, just make sure you still have the config file in there. Otherwise, it'll yell at you to add the --org and --project and all that when you try to build. Essentially, the only offending part in the broken script is this: \nexport

yammik avatar Nov 08 '19 21:11 yammik

This is still a problem. Another fix is here for NVM users: https://stackoverflow.com/a/50419734/8676545

Create symlink:

ln -s $(which node) /usr/local/bin/node

sinn1 avatar Apr 20 '21 22:04 sinn1

For me, I renamed my Sentry project and ran into this error... after wasting my life on hunting node issues all it took was setting the defaults.project in sentry.properties to the new project name for it to work!

pynner avatar Apr 24 '21 18:04 pynner

Guys, there is still no clear solution as far I as I can see.

Create symlink:

ln -s $(which node) /usr/local/bin/node

I see that the above is now the "sanctioned" solution as per the docs, but it is not a good solution because I don't want to override node system-wide!

Any other ideas?

elsurudo avatar Jun 25 '21 15:06 elsurudo

FWIW what I ended up doing is modifying the last 2 lines of the build steps "Bundle react native node and images" AND "Upload debug symbols to Sentry" to:

export NODE_BINARY=/hard/coded/path/to/correct/node
/hard/coded/path/to/correct/node <PREVIOUS CONTENTS OF LAST LINE>

This forces the sentry CLI script to use the same version of node as my project.

IMO your docs should be updated with a better solution

elsurudo avatar Jun 25 '21 16:06 elsurudo

Facing the same issue in React Native 0.69.3

SMKH-PRO avatar Aug 11 '22 19:08 SMKH-PRO

Here is solution from Sentry docs

ghost avatar Sep 05 '22 01:09 ghost

The solution for our team was to specify the correct cli executable within our sentry.properties since we are using a mono-repo:

cli.executable=../../node_modules/@sentry/cli/bin/sentry-cli

asleepace avatar May 08 '23 20:05 asleepace

This is still a problem. Another fix is here for NVM users: https://stackoverflow.com/a/50419734/8676545

Create symlink:

ln -s $(which node) /usr/local/bin/node

@sinn1 Big thanks. I was trying on xcode15.3, Finally its working

akhilesh-mourya avatar May 14 '24 10:05 akhilesh-mourya