Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No such file or directory (os error 2) for sentry-cli on step bundle RN code and images #484

Closed
2 of 5 tasks
tobiastornros opened this issue Sep 26, 2018 · 15 comments
Closed
2 of 5 tasks

Comments

@tobiastornros
Copy link

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS
  • Android

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

v10.11.0
6.4.1
app@1.1.1 /Users/tt/dev/app
├── @expo/status-bar-height@0.0.1
├── aws-amplify@1.1.3
├── aws-amplify-react-native@1.0.8
├── aws-sdk@2.322.0
├── fuse.js@3.2.1
├── react@16.5.0
├── react-native@0.57.1
├── react-native-animatable@1.3.0
├── react-native-fs@2.11.16
├── react-native-image-picker@0.26.10
├── react-native-image-resizer@1.0.0
├── react-native-intercom@10.2.0
├── react-native-iphone-x-helper@1.1.0
├── react-native-keyboard-aware-scroll-view@0.6.0
├── react-native-linear-gradient@2.4.2
├── react-native-material-textfield@0.12.0
├── react-native-modal@6.5.0
├── react-native-modest-checkbox@2.0.1
├── react-native-openanything@0.0.3
├── react-native-sentry@0.39.0
├── react-native-snap-carousel@3.7.4
├── react-native-spinkit@1.1.1
├── react-navigation@2.17.0
├── styled-components@3.4.9
├── tipsi-stripe@5.6.0
└── uuid@3.3.2

Xcode 9.4.1

Config:

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

I have following issue:

Archive or build from Xcode fails on step "Run custom shell script 'Bundle React Native code and images' with error: No such file or directory (os error 2)

Run or 'react-native run-ios' works.

Config in this step:

export NODE_BINARY=node
export SENTRY_PROPERTIES=sentry.properties

../node_modules/@sentry/cli/bin/sentry-cli react-native xcode \
  ../node_modules/react-native/scripts/react-native-xcode.sh

Everything works if I remove the sentry-cli part.

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

Tried to install node_modules with both npm and yarn.

Recently updated React Native from 0.54.0 to 0.57.1.

Steps to reproduce:

  • Install latest react-native-sentry and link via react-native link
  • Install sentry-cli via brew

Actual result:

  • Build failed, No such file or directory (os error 2) when trying to run sentry-cli script.

Expected result:

  • Build to succeed with sentry-cli.
@sundbry
Copy link

sundbry commented Sep 28, 2018

This should fix it for you: facebook/react-native#21383

@tobiastornros
Copy link
Author

@sundbry Didn´t solve my issue :/

@HazAT
Copy link
Member

HazAT commented Sep 28, 2018

Are you using nvm?
Just want to find out if node is the problem.
Also, can you make sure ../node_modules/@sentry/cli/bin/sentry-cli this file exists?

@tobiastornros
Copy link
Author

Installed node via Homebrew. which node = /usr/local/opt/node@8/bin/node (Downgraded to node8 to see if node 10 was the problem).

../node_modules/@sentry/cli/bin/sentry-cli exists.

@sundbry
Copy link

sundbry commented Sep 28, 2018 via email

facebook-github-bot pushed a commit to facebook/react-native that referenced this issue Oct 25, 2018
Summary:
Fix build errors when path to $NODE_BINARY contains spaces:

error: Can't find '/Path/With Spaces/To/node' binary to build React Native bundle

Why would $NODE_BINARY contain spaces? In my case, I am using sentry-cli which wraps the NODE_BINARY in it's own executable. The local path to the project, and thus the $NODE_BINARY, contains a space on my GoCD build agent.

'/Users/go/Library/Application Support/Go Agent/pipelines/my-ios-app/node_modules/sentry/cli/sentry-cli

See getsentry/sentry-react-native#484 getsentry/sentry-react-native#389
Pull Request resolved: #21383

Differential Revision: D10851141

Pulled By: yungsters

fbshipit-source-id: f46853ac8b57957864e0d1a76b8513403223fccb
kelset pushed a commit to facebook/react-native that referenced this issue Nov 9, 2018
Summary:
Fix build errors when path to $NODE_BINARY contains spaces:

error: Can't find '/Path/With Spaces/To/node' binary to build React Native bundle

Why would $NODE_BINARY contain spaces? In my case, I am using sentry-cli which wraps the NODE_BINARY in it's own executable. The local path to the project, and thus the $NODE_BINARY, contains a space on my GoCD build agent.

'/Users/go/Library/Application Support/Go Agent/pipelines/my-ios-app/node_modules/sentry/cli/sentry-cli

See getsentry/sentry-react-native#484 getsentry/sentry-react-native#389
Pull Request resolved: #21383

Differential Revision: D10851141

Pulled By: yungsters

fbshipit-source-id: f46853ac8b57957864e0d1a76b8513403223fccb
@export-mike
Copy link

export-mike commented Nov 11, 2018

Same issue for me. I'm on an older version of react-native@ so I added the same changes manually to my react-native-xcode.sh

line 89 > type "$NODE_BINARY" >/dev/null 2>&1 || nodejs_not_found
line 106 > "$NODE_BINARY" "$CLI_PATH" $BUNDLE_COMMAND \
  $CONFIG_ARG \
  --entry-file "$ENTRY_FILE" \
  --platform ios \
  --dev $DEV \
  --reset-cache \
  --bundle-output "$BUNDLE_FILE" \
  --assets-dest "$DEST" \
  $EXTRA_PACKAGER_ARGS

same error. I cannot exactly put an absolute path as my NODE_BINARY as it changes on different developer machines and CI.

@reyalpsirc
Copy link

I was having this problem and in my case it was because of the path I had for BUNDLE_CONFIG.

Before

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

After

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

@pascalgagneur
Copy link

Installed node via Homebrew. which node = /usr/local/opt/node@8/bin/node (Downgraded to node8 to see if node 10 was the problem).

../node_modules/@sentry/cli/bin/sentry-cli exists.

@tobiastornros did this solve your problem? I'm having the same problem as you described

@jaygould
Copy link

For me this probelm was caused by having spaces in my project directory. My project was "Users/me/Desktop/Some Folder/my-project" - I just took the space away from "Some Folder"

t-nanava pushed a commit to microsoft/react-native-macos that referenced this issue Jun 17, 2019
Summary:
Fix build errors when path to $NODE_BINARY contains spaces:

error: Can't find '/Path/With Spaces/To/node' binary to build React Native bundle

Why would $NODE_BINARY contain spaces? In my case, I am using sentry-cli which wraps the NODE_BINARY in it's own executable. The local path to the project, and thus the $NODE_BINARY, contains a space on my GoCD build agent.

'/Users/go/Library/Application Support/Go Agent/pipelines/my-ios-app/node_modules/sentry/cli/sentry-cli

See getsentry/sentry-react-native#484 getsentry/sentry-react-native#389
Pull Request resolved: facebook#21383

Differential Revision: D10851141

Pulled By: yungsters

fbshipit-source-id: f46853ac8b57957864e0d1a76b8513403223fccb
@cayodonatti
Copy link

cayodonatti commented Jul 19, 2019

Currently having the same problem with react-native 0.60.3 and Android build. Funnily enough, the problem does not occur when I have Hermes enabled.
Side note, sourcemaps not working with Hermes enabled.

@cayodonatti
Copy link

If anyone is stuck with the same problem, you can follow these steps:

  • Remove the applied plugin from android/app/build.gradle
  • Bundle javascript assets with react-native bundle
  • Upload the bundle and sourcemaps manually via sentry-cli .

All these steps can be added to package.json in a single command and run via yarn/npm. It worked with Hermes disabled, gonna test with Hermes enabled next week.

@crobinson42
Copy link

@cayodonatti That's ☝️ a work-around - I don't think the solution is to manually upload sourcemaps with the sentry-cli, this should work out of the box by the react-native-sentry package. (I'm not referring to Hermes)

@ahartzog
Copy link

ahartzog commented Aug 8, 2019

I'm seeing this on Android only as well, React native 0.59.10

@HazAT
Copy link
Member

HazAT commented Sep 4, 2019

I am closing all old issues, please if this is still a problem feel free to revive it.
Also, consider moving to our new SDK @sentry/react-native if it still happens there please open a new issue.

@HazAT HazAT closed this as completed Sep 4, 2019
@dccarmo
Copy link

dccarmo commented Sep 24, 2019

I'm seeing the same issue, using version 1.0.6, but only when building a new version of the app under CircleCI. It does not happen on my local machine.

Here's the error I'm getting:

Processing react-native sourcemaps for Sentry upload.
  INFO    2019-09-24 15:58:06.135443890 +00:00   bundle path: /home/circleci/project/android/app/build/generated/assets/react/stagingRelease/index.android.bundle
  INFO    2019-09-24 15:58:06.135461737 +00:00   sourcemap path: /home/circleci/project/android/app/build/generated/sourcemaps/react/stagingRelease/index.android.bundle.map
  DEBUG   2019-09-24 15:58:06.136041534 +00:00 Non-file bundle found
> Analyzing 2 sources
  DEBUG   2019-09-24 15:58:06.136122438 +00:00 error: running update nagger
  DEBUG   2019-09-24 15:58:06.136128457 +00:00 skipping update nagger because session is not attended
error: No such file or directory (os error 2)
  DEBUG   2019-09-24 15:58:06.136878112 +00:00 client close; no transport to shut down  (from sentry)

EDIT

The issue had nothing to do with Sentry but with Gradle failing to actually output the files expected by Gradle. This solution is what fixed for me: https://stackoverflow.com/a/56027775

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests