React-native: [0.46.3] fails to run on device

Created on 9 Jul 2017  路  10Comments  路  Source: facebook/react-native

Is this a bug report?

yes

Environment

react-native-cli: 2.0.1
react-native: 0.46.3
node: v8.1.0

Target Platform: iOS

Steps to Reproduce

Build iOS app for release, and try to run it on the actual iOS device.

The app will crash with error:

Error reading bundle /var/containers/Bundle/Application/62A1S7F9-6795-4S7E-93B3-A2F17FC5BFCF/MyApp.app/main.jsbundle

On the simulator, the app runs fine.
After downgrading to 0.45.1 everything worked on the device as well again.

Locked

Most helpful comment

Solved it. It seems that packager is trying to figure out node version installed on my system. The problem was that I am using nvm and default nvm node version was v5.7.1, and this was too old to build the app. However in my zsh config, I have nvm use v8.1.0 which is good, but it wasn't picking up v8.1.0 while building the app. The solution was to mark v8.1.0 as nvm default.

All 10 comments

That seems strange. Is this something you can reliably reproduce? For example, does it occur on a plain new project created with 0.46.1?

yes, create a plain new project and it fails for me.

@hramos any updates here? RN 0.46.3 has the same issue. 0.46.x is basically unusable because of this issue. As I said, it happens on a new project when trying to run it on the device using "Release" config. It should be very simple to reproduce.

I don't have any updates, I haven't seen any PR that addresses this specifically. If one is submitted and merged in, I can look into another point release.

Solved it. It seems that packager is trying to figure out node version installed on my system. The problem was that I am using nvm and default nvm node version was v5.7.1, and this was too old to build the app. However in my zsh config, I have nvm use v8.1.0 which is good, but it wasn't picking up v8.1.0 while building the app. The solution was to mark v8.1.0 as nvm default.

@ivpusic Hi, I too have this problem. When I deploy my app to a device when compiled for Release I see:

Error reading bundle /var/containers/Bundle/Application.../MyApp.app/main.jsbundle

I'm not using nvm - is there an alternative for brew? Node version is v8.2.0

Debug mode works fine (loading the bundle off my laptop)

resolving node binary/version is done here https://github.com/facebook/react-native/blob/master/scripts/react-native-xcode.sh#L54. Try to put some debug logs to see what is resolved.

@ivpusic @scgough Did either of you guys find any solution out there? Tried this with the very latest node/npm and still getting the problem.

having this issue as well.

if you ever installed nvm, and then deleted it (like me), then you can try rm -r ~/.nvm

https://github.com/facebook/react-native/blob/master/scripts/react-native-xcode.sh#L58

if [[ -s "$HOME/.nvm/nvm.sh" ]]; then
  . "$HOME/.nvm/nvm.sh"
elif [[ -x "$(command -v brew)" && -s "$(brew --prefix nvm)/nvm.sh" ]]; then
  . "$(brew --prefix nvm)/nvm.sh"
fi
Was this page helpful?
0 / 5 - 0 ratings

Related issues

anchetaWern picture anchetaWern  路  3Comments

despairblue picture despairblue  路  3Comments

aniss picture aniss  路  3Comments

lazywei picture lazywei  路  3Comments

vikeri picture vikeri  路  3Comments