Reputation: 1
I have tried to restart the server with npm start
, npx react-native run-ios
, npx react-native start
. Those commands don't work for me. Help me out to run this project its a project created with npx react native init projectName
.
warn No apps connected. Sending "reload" to all React Native apps failed. Make sure your app is running in the simulator or on a phone connected via USB.
The error shown on the emulator
Upvotes: 0
Views: 6351
Reputation: 23
I had the same problem and spent hours working on it. I figured out that METRO which is run using this command: npm start or this one npx react-native start couldn't find its way to my mobile app.
one of the solutions that I wasn't totally pleased of was this: a solution that works but has flows
but that workaround wasn't perfect because I had to re-run the command every single time I make a change. So after further researches I found out that the port 8081 is used by an another application that METRO is sending information to ( this is only my guess ). so:
I run the following:
netstat -aon | findstr 8081 // to get the PID of the application that is running on 8081 port
I opened task manager ( CRTL + ALT + del
) under the service section I looked up any
application which uses the PID that matches the one given by the command I ran and I have
forced stopping it.
retried npx react-native start
and npx react-native run-android
on my project
and the magic happened. It auto refreshes with every change, I wish it helps you.
Upvotes: 1
Reputation: 664
This is from the docs:
Method 2: Connect via Wi-Fi
You can also connect to the development server over Wi-Fi. You'll first need to install the app on your device using a USB cable, but once that has been done you can debug wirelessly by following these instructions. You'll need your development machine's current IP address before proceeding.
Open a terminal and type /sbin/ifconfig to find your machine's IP address.
Upvotes: 0
Reputation: 1059
Run adb reverse tcp:8081 tcp:8081
in your terminal then reload in the terminal after running yarn start
or npm start
, then reload. I hope this is helpful.
Upvotes: 1