sentry-react-native: sentry-cli : no such file or directory while building in Xcode

OS:

  • Windows
  • [*] MacOS
  • Linux

Platform:

  • [*] iOS
  • Android

SDK:

  • [*] @sentry/react-native (>= 1.0.0)
  • react-native-sentry (<= 0.43.2)

SDK version: 3.2.13

react-native version: 0.67.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/...'
  // other options
});

I have following issue:

Xcode’s “Bundle React native code and images” not able to find sentry-cli file. Give PhaseScriptExecution error: env: node: no such file or directory

Steps to reproduce:

  • brew install node
  • install sentry in react native project
  • run sentry wizard
  • build project in Xcode

Actual result:

PhaseScriptExecution error: env: node: no such file or directory

Expected result:

Build to be succeeded.

I am not using nvm. There is no nvm in my machine. when I run nvm command it says command not found

when I run which node it gives /opt/homebrew/bin/node

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 19 (7 by maintainers)

Most upvoted comments

I’m getting the same error on both, fresh project RN 0.67 and old project RN 0.66. Started a new project just to see which package was causing it, only sentry causes this error 😦 On a Mac M1.

Hi guys, I solved this problem finally. All you have to do is write this code in the terminal

$ which node
(example export -> `/opt/homebrew/Cellar/node@14/14.17.6/bin/node`)

Then write this $ ln -s /opt/homebrew/Cellar/node@14/14.17.6/bin/node /usr/local/bin/node

it worked after i did it. I hope it works for you too 🙏

Also, this is where I followed. https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/#using-node-with-nvm-or-volta

@akshitrcrm That works for me on a fresh project, likely something with your environment? Try to install it standalone? https://docs.sentry.io/product/cli/installation/#installation-via-npm

@marandaneto I think you got it wrong? This is not about the cli, it’s about Xcode not able to find the “sentry-cli” script file in the @sentry/react-native package, while building. env: node: no such file or directory - …/node_modules/@sentry/cli/bin/sentry-cli

Faced the same issue when trying to set up sentry with nvm. Ended up adding the following workaround to the build phase scripts

REACT_NATIVE_DIR="$(cd "$LOCROOT/../node_modules/react-native" && pwd)"
source "$REACT_NATIVE_DIR/scripts/find-node.sh"
...
...
export NODE_BINARY=node

I am getting the same response even when running sentry-cli directly not through Xcode. We had working CI setup for a long time, but now it stopped working (2 days ago).

Directory exists. Running on: Ubuntu LTS

sentry-cli" "--auth-token" "***" "upload-dif" "/home/runner/work/repo/dSYMs" "--org" myorg "app" "--project" "internal" "--log-level=debug"
  INFO    2022-02-25 16:47:41.376767987 +00:00 Issuing a command for Organization: myorg Project: internal
error: No such file or directory (os error 2)
  DEBUG   2022-02-25 16:47:41.377591460 +00:00 skipping update nagger because session is not attended

The only possible issue now then is that you are running bash or zsh interpreter inside your terminal, where XCode is running scripts though sh itself. In this case, you need to either:

  • move your PATH overrides from .bashrc (or .zshrc if using zsh) to .profile
  • update Xcode shell to use /bin/bash, /usr/local/bin/zsh or whatever interpreter you are using

No, we have arm builds for M1. The issue here appears to be npm configured to not run post-install scripts, which then skips fetching of cli. You can confirm that by going into node_modules/@sentry/cli and running ./scripts/install.js.

It should be a macOS m1 then, I just ran again on a normal macOS and it works.

@kamilogorek or @AbhiPrasad are you aware of any issues on Sentry Wizard or Sentry CLI (latest versions) on macOS m1?

@akshitrcrm That works for me on a fresh project, likely something with your environment? Try to install it standalone? https://docs.sentry.io/product/cli/installation/#installation-via-npm