question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

xcodebuild fails with "/node_modules/@sentry/cli/sentry-cli: cannot execute binary file"

See original GitHub issue

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS
  • Android

Output of node -v && npm -v && npm ls --prod --depth=0

bash-3.2$ node -v && npm -v && npm ls --prod --depth=0
v9.10.0
5.6.0
/Users/distiller
└── (empty)

Config:

Sentry.config('https://...@sentry.io/...', {
  logLevel: SentryLog.Error
}).install()

I have following issue:

xcodebuild fails during Bundle React Native code and images build phase. The build phase has the following content,

export SENTRY_PROPERTIES=sentry.properties
export NODE_BINARY=node
../node_modules/@sentry/cli/bin/sentry-cli react-native xcode \
    ../node_modules/react-native/scripts/react-native-xcode.sh

The error I get is the following,

[19:25:35]: ▸     export arch=arm64
[19:25:35]: ▸     export variant=normal
[19:25:35]: ▸     /bin/sh -c /Users/distiller/project/fastlane/generated/Build/Intermediates.noindex/ArchiveIntermediates/PoolOfficeManager/IntermediateBuildFilesPath/PoolOfficeManager.build/Release-iphoneos/PoolOfficeManager.build/Script-00DD1BFF1BD5951E006B06BC.sh
[19:25:35]: ▸ /Users/distiller/project/node_modules/@sentry/cli/sentry-cli: /Users/distiller/project/node_modules/@sentry/cli/sentry-cli: cannot execute binary file
[19:25:35]: ▸ Command /bin/sh failed with exit code 126

I am using,

  • Fastlane 2.78.0
  • CircleCI 2.0
  • XCode 9.3
  • React Native 0.53.0
  • React Native Sentry 0.36.0

Important Notes

  • I am running this on CircleCI.
  • If I comment out the Sentry part of the Bundle React Native code and images phase the build succeeds.
  • The build succeeds when running locally but fails when run in CircleCI.

Steps to reproduce: (Kind of hard to reproduce with CircleCI being involved however this is the xcodebuild command that fails)

  • set -o pipefail && xcodebuild -scheme <scheme name> -project ios/<project name>.xcodeproj -configuration Release -destination ‘generic/platform=iOS’ -archivePath fastlane/generated/POM\ 2018-05-01\ 19.22.13.xcarchive -derivedDataPath ‘fastlane/generated’ clean archive | tee /Users/distiller/project/fastlane/generated/<log file name>.log | xcpretty

Actual result:

  • Build fails saying /Users/distiller/project/node_modules/@sentry/cli/sentry-cli: cannot execute binary file

Expected result:

  • Build Succeeds

Please let me know if you need any additional details (React Native + Fastlane + CircleCI + MacOS + Xcode is a lot of moving parts), been trying to fix this for about 7 hours now and any help would be greatly appreciated!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jamesmcn1commented, Jan 28, 2019

hi @amast09 thanks for your help ! i just run yarn upgrade react-native-sentry as a build step in my Circle config.yml which seems to fix this problem

1reaction
amast09commented, Jan 27, 2019

@jamesmcn1 here is the relevant sections of my Circle configuration,

  workspace_root: &workspace_root
    ~/project

  attach_workspace: &attach_workspace
    attach_workspace:
      at: *workspace_root

  ios_bundle_cache_key: &ios_bundle_cache_key
    v2-ios-dependency-bundle-{{ checksum "~/project/Gemfile.lock" }}

  ios_bundle_backup_cache_key: &ios_bundle_backup_cache_key
    v2-ios-dependency-bundle

  restore_ios_bundle: &restore_ios_bundle
    restore_cache:
      keys:
        - *ios_bundle_cache_key
        - *ios_bundle_backup_cache_key

  ios_container_config: &ios_container_config
    working_directory: ~/project
    macos:
      xcode: "9.3.0"
    environment:
      - LANG: "en_US.UTF-8"
      - LC_ALL: "en_US.UTF-8"
      - LOCALE: "en_US.UTF-8"
    shell: /bin/bash --login -eo pipefail

  build_ipa:
    <<: *ios_container_config
    steps:
      - *attach_workspace
      - *restore_ios_bundle
      - run:
          name: Install Sentry CLI
          command: curl -sL https://sentry.io/get-cli/ | bash
      - run:
          name: Install CocoaPods
          command: |
            curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf
            cd ios && pod install

hopefully it can help you 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

xcodebuild fails with "/node_modules/@sentry/cli ... - GitHub
Build fails saying /Users/distiller/project/node_modules/@sentry/cli/sentry-cli: cannot execute binary file. Expected result: Build Succeeds.
Read more >
Cannot execute binary file on xcode - ios - Stack Overflow
I cannot run build with error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: ...
Read more >
How can I resolve the error "cannot execute binary file"?
Usually that error message means Linux doesn't recognize the file as a shell script or as an executable file. Typically the cause is...
Read more >
<path to command>: cannot execute binary file - AskF5
In this error message, note the following: <path to command> is the full path of the command on the file system. For example:...
Read more >
Have a Question? Ask the Community
I`m trying to instal OPM on RHEL 7, when i try to create CredFile by using the CreateCredFile i get an error "cannot...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found