Stuck on info starting JS server

十年热恋 提交于 2021-02-06 14:50:07

问题


I have initiated successfully a new react-native project. Then, every time I try to run my newly built project using the command react-native run-android, it gets stucks on info Starting JS server....

Here is the output:

$ react-native run-android
info Running jetifier to migrate libraries to AndroidX".
 You can disable it using "--no-jetifier" flag.
Jetifier found 855 file(s) to forward-jetify. Using 4 workers...
info Starting JS server..."

I tried restarting the laptop and switching emulators. I don't know what else to do anymore.

How do I solve the problem?


回答1:


Kill the automatically popped up metro bundler command prompt

Kill the command terminal which is running react-native run-android

Now Run react-native start This will start your js server

In new command prompt window run react-native run-android The app came up in 5 mins in an emulator.




回答2:


Linux: Go to the terminal and type: react-native start

and then in OTHER terminal, inside your project folder: yarn android or npm run android




回答3:


I had the same problem. I started a project yesterday and it worked, started a new one today and it didn't work. The problem seems to be "@react-native-community/cli-platform-android". The version that showed up today is 2.8.2 as opposed to 2.7.0 for yesterday's project.

I used: npm install @react-native-community/cli-platform-android@2.7.0

This is not a optimal solution, but it will get you going.




回答4:


Temporary fix:

REACT_TERMINAL= react-native run-android

in my case with manjaro + xfce4:

REACT_TERMINAL=xfce4-terminal react-native run-android

or puts in your .bashrc:

export REACT_TERMINAL=xfce4-terminal

font: https://github.com/facebook/react-native/issues/26097




回答5:


I had the exact same frustrating issue for a very different reason than mentioned in other answers.

As explained in this SO answer Android adb binds to port 5037 and I installed some program which took this port so adb was hanging silently (why adb! .. say something!)

Commands to test if this your issue cause:

test any adb command and see if it hangs, eg:

adb devices

If it does, then check who is using the port:

sudo lsof -i :5037



回答6:


The best solution that I constantly find myself using, is going to the application manager on android, then clearing the data of the app. Running the app afterwards goes smoothly without lagging.




回答7:


Reinstalling android studio with a new emulator or changing the app name in app.json , build.gradle and android manifest.xml solved the issue.



来源:https://stackoverflow.com/questions/57313661/stuck-on-info-starting-js-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!