bearacuda13
bearacuda13

Reputation: 1854

React Native iOS simulator "Connect to Metro to Develop Javascript"

I'm running a react native app and constantly running into the issue of the app not connecting to the code to do automatic updates.

Things I've tried:

This is the screen on starting up, which offers the advice, "Connect to Metro to develop JavaScript."

Connect to Metro to develop JavaScript.

From the metro bundler that automatically starts up, I get this message when I type 'r' to reload that says, "React Native: No apps connected."

"No apps connected"

I'm using 0.61 and always have been.

What else should I try?

EDIT

I was able to get it working by restarting my computer (again).

Every once in a while, a restart does the trick, yet most of the time it doesn't work. There still has to be a more reliable way of fixing this.

Upvotes: 9

Views: 22169

Answers (9)

Marko Petricic
Marko Petricic

Reputation: 31

I struggled with this from time to time for over 2 years...

What worked for me is:

  • run the app npx react-native run-ios
  • metro will open up and app will be installed on a device. Problem is that the app is not connected with metro
  • open dev menu (shake)
  • choose Configure bundler
  • choose Reset to default

App will connect with metro right away and you will be able to see your changes

Hope this helps...

Upvotes: 0

iamJohnvesly
iamJohnvesly

Reputation: 947

Shake your phone which has the app build installed, configure bundler- Give your Device IP (Laptop) address and Port : 8081 (port your running) and Reload

Upvotes: 0

Hammad Hassan
Hammad Hassan

Reputation: 622

For me , metro server was not running in the background so I just ran the npm start and reloaded the simulator and changes appears!

Upvotes: 0

Sherif Samir
Sherif Samir

Reputation: 685

Try this while you have your metro bundler opened,

1-delete app and rerun

2-popup message will appear "this app would like to connect to other app on network" Press OK

3- shake your iphone --> configure bundler -->Reset to default

Upvotes: 3

Hammad Siraj
Hammad Siraj

Reputation: 101

If the above solutions won't work just make sure that you select the scheme as a debug not release. **

How to edit scheme :

** Xcode 12.4 => Product > scheme > edit scheme > run > info > Build Configuration > select debug.

Upvotes: 2

wentris
wentris

Reputation: 503

Dev menu looks like:

enter image description here

In my case it could happen after recreating main.jsbundle

  1. Open any installed ios simulator.
  2. install your app (npm run ios)
  3. press cmd + d being focused on simulator
  4. choose configure bundler

bundler preferences:

enter image description here

  1. bundler address - 127.0.0.1
  2. port - 8081

then simulator will reconnect itself

Upvotes: 16

Hamed Kharazmi
Hamed Kharazmi

Reputation: 449

Go to device simulator and shake then configure bundler for example 127.0.0.1:8081

Upvotes: 3

suther
suther

Reputation: 13578

I had the same issue some time before. Suddenly the App doesn't work anymore if starting only with XCode. I have to start the metro-bundler via CLI... and if running, I had to use "XCode" to run the App. As the metro-bundler still running in the background, XCode didn't start it's own, and the connection could be established.

I've described my request here... which sounds a bit similar to yours. Now I don't have any issues anymore if starting from xcode directly. Maybe this was caused of an upgrade of XCode (my current XCode-Version: 10.3)

Upvotes: 6

Shing Ho Tan
Shing Ho Tan

Reputation: 951

Are you having this issue while testing on the phone? I think you should enable the wifi in same network with computer.

Upvotes: 1

Related Questions