Description
Is this a bug report?
Yes
Have you read the Contributing Guidelines?
Yes
Environment
Environment:
OS: Linux 4.13 (Ubuntu 17.10)
Node: 8.9.4
Yarn: 1.3.2
npm: 5.6.0
Watchman: Not Found
Xcode: N/A
Android Studio: 3.0 AI-171.4443003
Packages: (wanted => installed)
react: 16.2.0 => 16.2.0
react-native: 0.52.0 => 0.52.0
Target Platform: android:minSdkVersion="16"
android:targetSdkVersion="23"
Steps to Reproduce
(On a linux machine)
- run command "sudo lsof -i :8081" and kill any processes on that port with the command "kill -9 "
- react-native init test
- cd test
- react-native run-android
- close/stop terminal (either by closing out of the terminal or pressing ctrl+c; doesn't matter)
- run command "sudo lsof -i :8081".
Expected Behavior
There are no processes active on port 8081 and you can run "react-native run-android" any time in the future and it works.
Actual Behavior
The JS server is still running on port 8081. I do not understand why, but this creates a problem when running the app again. After starting the intent (usually the last thing in the terminal after running react-native run-andriod), it just stops automatically as seen in my terminal below:
Versus how I usually stop it as seen in my terminal below:
Reproducible Demo
https://github.com/BWillis98/test
I apologize that I know nothing about "snack", but I've uploaded the test repository I created when going through "Steps to reproduce". I don't think it's really necessary since all I did was run the command "react-native init test" and then push it to a github repository.
Workaround To Problem
Run the command "sudo lsof -i :8081", make note of the PID of the process where the column under "COMMAND" is titled "node", and then run the command "kill -9 [PID]" as demonstrated here:
However, I don't want to do this every time I want to load the app onto my phone and it took a lot of time to narrow down the issue to this and I'd like to save future developers the time of fixing this issue.