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

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

Closed
steve-ng opened this issue Dec 20, 2015 · 29 comments
Closed
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@steve-ng
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor Author

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

@NexusLee
Copy link

I got this error too

@onzag
Copy link

onzag commented Dec 20, 2015

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

@qbig
Copy link
Contributor

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
Copy link

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
Copy link

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

@onzag
Copy link

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
Copy link

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
Copy link

@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
Copy link

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.

@shesio
Copy link

shesio commented Dec 21, 2015

how to solve this?

@andreyluiz
Copy link

Same here.

@andreyluiz
Copy link

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
Copy link

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
Copy link
Contributor

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

@qbig
Copy link
Contributor

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
Copy link
Contributor

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

@dkokic
Copy link

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
Copy link

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
Copy link

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
Copy link
Collaborator

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

@herbertdai
Copy link

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

@andreyluiz
Copy link

It worked. @satya164 👍

@zereraz
Copy link

zereraz commented Dec 28, 2015

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

@cubbuk
Copy link

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
Copy link

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
Copy link

@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.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests