Build is successfully getting run but the development server is closing, as of that my React-native app is not able to run on emulator
You can check the error on the emulator, kindly do tell me the reason.
You could try adb reverse tcp:8081 tcp:8081 in cmd and it could help you.
Related
I am working on a simple react project on Windows 10 Pro. On trying to run the project with wsl with zsh (npm start) everything works, I get warnings and compilation is done without any errors. The issue I am facing is automatic launch of browser from wsl is not happening.
If I manually open localhost:3000 on my chrome after this command everything works but I would like the wsl terminal to launch my browser on npm start automatically just like it does in most of my other terminals and powershell on windows.
What I have tried:
added a export browser property to my .zshrc with path to chrome from here
Added a bsconfig file to root with following code to set open = true as per from here
I have added the ports from 3000-3999 to my firewall so that wsl can access my host (localhost ip). this fixed previous issue where localhost:3000 would show connection refused error.
I would be happy to provide any more details.
I am very new to wsl and zsh and I would really appreciate any help. Thanks
I'm working on Windows 7. first connection is working, but reload doesn't work and it says no device attached and check by "adb devices", turned to offline. Windows 10 works and no error.
In your package.json under scripts you can add something like this :
"android-dev": "adb reverse tcp:8081 tcp:8081 && react-native run-android"
Then you can simply run npm run android-dev and you're all set.
I am new to the node world. I created a node js rest API. When I run npm start in my local machine or in the terminal for the first time, I can see console.log() in my terminal. Now, I am running the same application on an AWS Ec2 instance with Ubuntu as os. I run npm start and serve my app on port 80. I do this via ssh and after running my server I close the ssh connection. But when I reconnect via ssh, I want to see those console.log() messages in my terminal for some purpose.
I completely understand that logging messages in the terminal is not a good idea and there can be so many alternatives. Just want to know how to access the same terminal window/result as we see when I start my application.
if you are using pm2, you can try "pm2 logs"
So Nodemon won't work well in a production server or in any instance where you need to have the app going by itself.
Nodemon is a dev tool to enable you to restart your server during development. In a "real" vps you need to place the process in the background or it will be automatically killed when the connection times out.
Check out this YT series for a correct deploy architecture in an NGINX server with the use of pm2 and NGINX on a Red Hat server, I've personally used it more than once:
https://www.youtube.com/playlist?list=PLQlWzK5tU-gDyxC1JTpyC2avvJlt3hrIh
(I'm almost a newbie in React Native development) today I have started a new project in React Native 0.60 (react-native init MyApp).
After that I typed : react-native run-android to check if everything worked.
After the bundle process is finished
I can finally get my welcome screen in my connected devices
But, if I try to reload the app from my devices I get this error:
How could I address this error ?
EDIT: Thank you for your answers, anyway, I have tried all solutions you suggest but I still get the same problem. I also noticed that when i run react-native run-android Metro Bundler (open in a new cli window) seems to start but it suddenly disappear. I think the problem could be with the message 'Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0'
react-native run-android not working in new react-native version
0.60
now you can use
react-native start
OR
npm start
both command is work
Please use the following two commands and then can start the react native again.
- adb reverse tcp:8081 tcp:8081
- killall node
Then you can run the following the command.
react-native start
Now you can run your application again.
Have a good day.
You need to connect your phone to the server, follow the below steps:
[For detailed help follow this https://facebook.github.io/react-native/docs/running-on-device]
1. Open the developer menu on phone.
2. Open 'Debug server host & port for device'.
3. Type in your machine's IP address and the port of the local dev server (eg. 10.0.1.1:8081). If you have connected over wifi then this will be your computers ip address. (If you are running in your computer I think instead of ip address it would be 'localhost:8081')
4. Go back to the Dev menu and select reload.
Hope it would help.
You need to run adb reverse in the Android Studio terminal so your device can connect to the server. Open Android Studio and click on the terminal button at the bottom. In the terminal, and with your device connected to your computer, enter the command adb devices. This will list the name of the connected Android device. Copy that name. Then enter this command adb -s <device name> reverse tcp:8081 tcp:8081. When you run that command replace <device name> with the name of your device you copied from the other command.
Here is a link to an explanation in the React Native documentation
I've weird problem with react native. My first app worked great on emulator and building was fine but now when I tried to run my second app on emulator i reciving an error:
Could not connect to development server and possible fixes under it.
Why is this happening? I did all the same like last time when all worked.
Emulator is visible for adb:
C:\Users\Computer>adb devices
List of devices attached
emulator-5554 device
react-native run-android:
BUILD SUCCESSFUL
Total time: 41.496 secs
Running ANDROID_HOME=C:\Users\Bartas\AppData\Local\Android\sdk/platform-
tools/adb -s emulator-5554 reverse tcp:8081 tcp:8081
Could not run adb reverse: spawnSync
ANDROID_HOME=C:\Users\Bartas\AppData\Local\
Android\sdk/platform-tools/adb ENOENT
Starting the app on emulator-5554
(ANDROID_HOME=C:\Users\Bartas\AppData\Local\An
droid\sdk/platform-tools/adb -s emulator-5554 shell am start -n
com.auth/com.auth.MainActivity)...
Okey, asked question too fast on stack.. Soory..
The problem was that my var had that value:
'ANDROID_HOME=C:\Users\Bartas\AppData\Local\Android\sdk/platform- tools/adb'
Just deleted 'ANDROID_HOME=' part and it works again.