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

Can't find variable: __fbBatchedBridge (line 1 in the generated bundle) #4881

Closed
steve-ng opened this Issue Dec 20, 2015 · 29 comments

Comments

Projects
None yet
@steve-ng
Contributor

steve-ng commented Dec 20, 2015

new project on react-native 0.17.0 Android

does anyone experience this too?

answers as below:
adb reverse tcp:8081 tcp:8081

@facebook-github-bot

This comment has been minimized.

Show comment
Hide comment
@facebook-github-bot

facebook-github-bot Dec 20, 2015

Hey steve-ng, thanks for reporting this issue!

React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.

  • If you don't know how to do something or not sure whether some behavior is expected or a bug, please ask on StackOverflow with the tag react-native or for more real time interactions, ask on Discord in the #react-native channel.
  • If this is a feature request or a bug that you would like to be fixed, please report it on Product Pains. It has a ranking feature that lets us focus on the most important issues the community is experiencing.
  • We welcome clear issues and PRs that are ready for in-depth discussion. Please provide screenshots where appropriate and always mention the version of React Native you're using. Thank you for your contributions!

Hey steve-ng, thanks for reporting this issue!

React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.

  • If you don't know how to do something or not sure whether some behavior is expected or a bug, please ask on StackOverflow with the tag react-native or for more real time interactions, ask on Discord in the #react-native channel.
  • If this is a feature request or a bug that you would like to be fixed, please report it on Product Pains. It has a ranking feature that lets us focus on the most important issues the community is experiencing.
  • We welcome clear issues and PRs that are ready for in-depth discussion. Please provide screenshots where appropriate and always mention the version of React Native you're using. Thank you for your contributions!
@qbig

This comment has been minimized.

Show comment
Hide comment
@qbig

qbig Dec 20, 2015

@steve-ng There is a chance that your packager is not running. This happens when you tried to pass an empty bundle file to jsc to execute.

qbig commented Dec 20, 2015

@steve-ng There is a chance that your packager is not running. This happens when you tried to pass an empty bundle file to jsc to execute.

@steve-ng

This comment has been minimized.

Show comment
Hide comment
@steve-ng

steve-ng Dec 20, 2015

Contributor

thanks @qbig is there any possible place that I can check this? I didn't fiddle with my packager

Contributor

steve-ng commented Dec 20, 2015

thanks @qbig is there any possible place that I can check this? I didn't fiddle with my packager

@NexusLee

This comment has been minimized.

Show comment
Hide comment
@NexusLee

NexusLee Dec 20, 2015

I got this error too

I got this error too

@onzag

This comment has been minimized.

Show comment
Hide comment
@onzag

onzag Dec 20, 2015

I'm getting this error as well, however if I switch to production then it doesn't happen.

onzag commented Dec 20, 2015

I'm getting this error as well, however if I switch to production then it doesn't happen.

@qbig

This comment has been minimized.

Show comment
Hide comment
@qbig

qbig Dec 20, 2015

@steve-ng not sure but if you 'npm start' at your project dir did the packager start normally? @onzag if you switch to production, you would be using a pre-bundle file. So it wouldn't happen.

qbig commented Dec 20, 2015

@steve-ng not sure but if you 'npm start' at your project dir did the packager start normally? @onzag if you switch to production, you would be using a pre-bundle file. So it wouldn't happen.

@onzag

This comment has been minimized.

Show comment
Hide comment
@onzag

onzag Dec 20, 2015

@qbig I understand that, what I'm supposing is that the server is not actually running; but my question is, as I run react-native run-android I don't really seem to get any server running, I'm trying to find out where it is, but all the good guides I find are for xcode. I'm a bit lost here.

onzag commented Dec 20, 2015

@qbig I understand that, what I'm supposing is that the server is not actually running; but my question is, as I run react-native run-android I don't really seem to get any server running, I'm trying to find out where it is, but all the good guides I find are for xcode. I'm a bit lost here.

@trungdq88

This comment has been minimized.

Show comment
Hide comment
@trungdq88

trungdq88 Dec 20, 2015

Having a same issue here. Can't run the default project on Android (iOS works).

Having a same issue here. Can't run the default project on Android (iOS works).

@onzag

This comment has been minimized.

Show comment
Hide comment
@onzag

onzag Dec 20, 2015

@qbig @steve-ng @trungdq88 I found what's the reason of this issue, first make sure you have watchman installed if you're on windows or linux; https://facebook.github.io/watchman/docs/install.html

Then you make sure to run react-native start before running react-native run-android so that the server, and the packager is running... you'll most likely anyway hit the error.

Shake your device or hit the menu and go to Dev Settings, Debug Server host and port, seek for the host and port of your computer, and put them there... eg. 192.168.1.4:8081 in my case, then shake again and click reload JS, all it's set up :)

onzag commented Dec 20, 2015

@qbig @steve-ng @trungdq88 I found what's the reason of this issue, first make sure you have watchman installed if you're on windows or linux; https://facebook.github.io/watchman/docs/install.html

Then you make sure to run react-native start before running react-native run-android so that the server, and the packager is running... you'll most likely anyway hit the error.

Shake your device or hit the menu and go to Dev Settings, Debug Server host and port, seek for the host and port of your computer, and put them there... eg. 192.168.1.4:8081 in my case, then shake again and click reload JS, all it's set up :)

@onzag

This comment has been minimized.

Show comment
Hide comment
@onzag

onzag Dec 20, 2015

Also make sure you have the gradle daemon running just that it doesn't take ages. https://docs.gradle.org/2.9/userguide/gradle_daemon.html happy coding :)

onzag commented Dec 20, 2015

Also make sure you have the gradle daemon running just that it doesn't take ages. https://docs.gradle.org/2.9/userguide/gradle_daemon.html happy coding :)

@trungdq88

This comment has been minimized.

Show comment
Hide comment
@trungdq88

trungdq88 Dec 20, 2015

@onzag thank you, it works now. Btw, my server is automatically start when I run react-native android, so I think might be a gradle daemon problem. (Or is it just works because I just have restarted my device?)

@onzag thank you, it works now. Btw, my server is automatically start when I run react-native android, so I think might be a gradle daemon problem. (Or is it just works because I just have restarted my device?)

@onzag

This comment has been minimized.

Show comment
Hide comment
@onzag

onzag Dec 20, 2015

@trungdq88 well to be fair I'm not sure, I've never used gradle before, also, I'm on linux mint now, it might be a platform differences problem, if you're using mac that's what it supposed to happen.

I also noticed that the device has to be connected to the same network of the computer, I'm trying to find a workaround for offline usage, because making sure that the device is connected wirelessly in the same LAN of the computer could be annoying in some circumstances.

onzag commented Dec 20, 2015

@trungdq88 well to be fair I'm not sure, I've never used gradle before, also, I'm on linux mint now, it might be a platform differences problem, if you're using mac that's what it supposed to happen.

I also noticed that the device has to be connected to the same network of the computer, I'm trying to find a workaround for offline usage, because making sure that the device is connected wirelessly in the same LAN of the computer could be annoying in some circumstances.

@hiquanta

This comment has been minimized.

Show comment
Hide comment
@hiquanta

hiquanta Dec 21, 2015

how to solve this?

how to solve this?

@andreyluiz

This comment has been minimized.

Show comment
Hide comment

Same here.

@andreyluiz

This comment has been minimized.

Show comment
Hide comment
@andreyluiz

andreyluiz Dec 21, 2015

I tried to run react-native start and I got:

Looking for JS files in
   /home/andrey/Projects/React/NativeTest 

[11:31:16] <START> Building Dependency Graph
[11:31:16] <START> Crawling File System
[11:31:16] <START> Loading bundles layout
[11:31:16] <END>   Loading bundles layout (0ms)

React packager ready.

Next I tried to issue in another terminal the command react-native run-android to run in my Nexus 5, connected to my laptop. The packager terminal added the following:

[11:31:43] <END>   Crawling File System (26401ms)
[11:31:43] <START> Building in-memory fs for JavaScript
[11:31:47] <END>   Building in-memory fs for JavaScript (4036ms)
[11:31:47] <START> Building in-memory fs for Assets
[11:31:51] <END>   Building in-memory fs for Assets (3884ms)
[11:31:51] <START> Building Haste Map
[11:31:53] <START> Building (deprecated) Asset Map
[11:31:53] <END>   Building (deprecated) Asset Map (777ms)
[11:31:54] <END>   Building Haste Map (3028ms)
[11:31:54] <END>   Building Dependency Graph (37950ms)

The app starts in my Nexus, but still the error occurs.
Any tips?

I tried to run react-native start and I got:

Looking for JS files in
   /home/andrey/Projects/React/NativeTest 

[11:31:16] <START> Building Dependency Graph
[11:31:16] <START> Crawling File System
[11:31:16] <START> Loading bundles layout
[11:31:16] <END>   Loading bundles layout (0ms)

React packager ready.

Next I tried to issue in another terminal the command react-native run-android to run in my Nexus 5, connected to my laptop. The packager terminal added the following:

[11:31:43] <END>   Crawling File System (26401ms)
[11:31:43] <START> Building in-memory fs for JavaScript
[11:31:47] <END>   Building in-memory fs for JavaScript (4036ms)
[11:31:47] <START> Building in-memory fs for Assets
[11:31:51] <END>   Building in-memory fs for Assets (3884ms)
[11:31:51] <START> Building Haste Map
[11:31:53] <START> Building (deprecated) Asset Map
[11:31:53] <END>   Building (deprecated) Asset Map (777ms)
[11:31:54] <END>   Building Haste Map (3028ms)
[11:31:54] <END>   Building Dependency Graph (37950ms)

The app starts in my Nexus, but still the error occurs.
Any tips?

@elinac

This comment has been minimized.

Show comment
Hide comment
@elinac

elinac Dec 21, 2015

I got the same error when i try to run react-native/Examples/UIExplorer release apk.I slove it after I change the BundleAssetName and JSMainModuleName in react-native\Examples\UIExplorer\android\app\src\main\java\UIExplorerActivity.java.
Maybe you can try correcting your React-Native Actitivy.

elinac commented Dec 21, 2015

I got the same error when i try to run react-native/Examples/UIExplorer release apk.I slove it after I change the BundleAssetName and JSMainModuleName in react-native\Examples\UIExplorer\android\app\src\main\java\UIExplorerActivity.java.
Maybe you can try correcting your React-Native Actitivy.

@satya164

This comment has been minimized.

Show comment
Hide comment
@satya164

satya164 Dec 23, 2015

Collaborator

Make sure that you also run adb reverse tcp:8081 tcp:8081 when testing on device.

Collaborator

satya164 commented Dec 23, 2015

Make sure that you also run adb reverse tcp:8081 tcp:8081 when testing on device.

@qbig

This comment has been minimized.

Show comment
Hide comment
@qbig

qbig Dec 23, 2015

@satya164 based on the number of ppl got stuck on this, maybe #4739 ? Should be a useful but minor fix. Or would you suggest other approach like fixing the doc?

qbig commented Dec 23, 2015

@satya164 based on the number of ppl got stuck on this, maybe #4739 ? Should be a useful but minor fix. Or would you suggest other approach like fixing the doc?

@satya164

This comment has been minimized.

Show comment
Hide comment
@satya164

satya164 Dec 23, 2015

Collaborator

@qbig A PR to improve the error message is much appreciated.

Collaborator

satya164 commented Dec 23, 2015

@qbig A PR to improve the error message is much appreciated.

@dkokic

This comment has been minimized.

Show comment
Hide comment
@dkokic

dkokic Dec 23, 2015

Just to make it clear, this error shows after updating react-native dependencies to 0.17.0
The very same code "works" with react-native 0.16.0 (packager running, reverse proxy set)

dkokic commented Dec 23, 2015

Just to make it clear, this error shows after updating react-native dependencies to 0.17.0
The very same code "works" with react-native 0.16.0 (packager running, reverse proxy set)

@onzag

This comment has been minimized.

Show comment
Hide comment
@onzag

onzag Dec 24, 2015

@andreyluiz Currently you have to shake your device and pick in Dev settings the ip and port of your computer so that the device can access the server.

onzag commented Dec 24, 2015

@andreyluiz Currently you have to shake your device and pick in Dev settings the ip and port of your computer so that the device can access the server.

@onzag

This comment has been minimized.

Show comment
Hide comment
@onzag

onzag Dec 24, 2015

@dkokic in 0.17.0 you don't need to set the reverse proxy... you just have to set the IP and port of your computer, that's for remote usage, so it makes sense to use it that way. However I may be wrong, I only started using this library 1 week ago.

onzag commented Dec 24, 2015

@dkokic in 0.17.0 you don't need to set the reverse proxy... you just have to set the IP and port of your computer, that's for remote usage, so it makes sense to use it that way. However I may be wrong, I only started using this library 1 week ago.

@brentvatne

This comment has been minimized.

Show comment
Hide comment
@brentvatne

brentvatne Dec 24, 2015

Collaborator

Related to #4739, PR welcome to improve the message!

Collaborator

brentvatne commented Dec 24, 2015

Related to #4739, PR welcome to improve the message!

@brentvatne brentvatne closed this Dec 24, 2015

@herbertdai

This comment has been minimized.

Show comment
Hide comment
@herbertdai

herbertdai Dec 26, 2015

Thanks @satya164, adb reverse tcp:8081 tcp:8081 this fixed my issue.

Thanks @satya164, adb reverse tcp:8081 tcp:8081 this fixed my issue.

@andreyluiz

This comment has been minimized.

Show comment
Hide comment

It worked. @satya164 👍

@raunaqrox

This comment has been minimized.

Show comment
Hide comment
@raunaqrox

raunaqrox Dec 28, 2015

adb reverse tcp:8081 tcp:8081
this only works for android 5.0+ (API 21)

adb reverse tcp:8081 tcp:8081
this only works for android 5.0+ (API 21)

@cubbuk

This comment has been minimized.

Show comment
Hide comment
@cubbuk

cubbuk Jan 14, 2016

Same here, I tried to run it on genymotion emulator. I had to run adb reverse tcp:8081 tcp:8081, then react-native start then react-native run-android to run an android app on Ubuntu 14.04. I am using react-native 0.17.0 as a dependency.

cubbuk commented Jan 14, 2016

Same here, I tried to run it on genymotion emulator. I had to run adb reverse tcp:8081 tcp:8081, then react-native start then react-native run-android to run an android app on Ubuntu 14.04. I am using react-native 0.17.0 as a dependency.

@sfatih

This comment has been minimized.

Show comment
Hide comment
@sfatih

sfatih Feb 15, 2016

My problem solved!
I was getting this error when i try to
react-native run-android on stock android avm
screenshot_2016-02-15-13-32-08-

What I do?
After Run react-native run-android and get "_fbBatchedBridge" error,
i run react-native start
react-packager
Then clicked "Reaload JS" button on AVM,
Then waited for some(about 1.5 min) process in packager and i get this:
react-packager2

Then my app ready:
react-avm-running

If you still cant reload your JS. In windows(AVM);

Press F2 -> Dev Settings -> Debug server host & port for device -> Write "localhost:8081"

For your Android Device(Physical) on same Wifi
Press F2 -> Dev Settings -> Debug server host & port for device -> Write "(Your pc ip address):8081"

sfatih commented Feb 15, 2016

My problem solved!
I was getting this error when i try to
react-native run-android on stock android avm
screenshot_2016-02-15-13-32-08-

What I do?
After Run react-native run-android and get "_fbBatchedBridge" error,
i run react-native start
react-packager
Then clicked "Reaload JS" button on AVM,
Then waited for some(about 1.5 min) process in packager and i get this:
react-packager2

Then my app ready:
react-avm-running

If you still cant reload your JS. In windows(AVM);

Press F2 -> Dev Settings -> Debug server host & port for device -> Write "localhost:8081"

For your Android Device(Physical) on same Wifi
Press F2 -> Dev Settings -> Debug server host & port for device -> Write "(Your pc ip address):8081"

@ufo22940268

This comment has been minimized.

Show comment
Hide comment
@ufo22940268

ufo22940268 Feb 17, 2016

@stavash Thanks. It works. I think this answer should go to tutorial.

@stavash Thanks. It works. I think this answer should go to tutorial.

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