React-native get stuck at Dependency Graph

2020-06-30 11:16发布

问题:

I try to start with react-native, I've installed everything and got to phase where I have RSoD on my phone which is telling me to run server. When i run react-native start lot of things runs, but then it gets stuck at <END> Building Dependency Graph and I have no idea what to do with it. So, how can I make it continue?

回答1:

The building of the dependency graph may take some time (ca 1-3 minutes). The progress is shown by a percentage behind this line; if the percentage disappears you are ready. The react-native start command doesn't terminate, as it continues to serve the transformed source code with the react native packager. Your app will make requests to the provided url if you have the default settings.



回答2:

One reason the "Building Dependency Graph" step might hang may be due to that there is a (Chrome) debugger session running from a previous session or another project. One way to fix that is to completely quit out of Xcode, your terminal, and Chrome and then restart everything. I'm sure there is a better way to fix the issue, but that is what worked for me.



回答3:

I had the same problem, that it ended there and even refreshing the simulator didn't make the packager to go on. Then I figured it out: I was still connected to the Internet via a VPN, so the simulator couldn't connect to the packager. Simply closing the VPN solved the issue.



回答4:

In my case I opened

Command prompt

as Administrator reached to the app location and enter

react-native start

it goes till Loading dependency graph, done. Then I remained it open and open another command prompt as Administrator go to the app location and entered

react-native run-android

and its worked....

In mac open Terminal instead of Command prompt and rest is same.

Peace ...



回答5:

After the command react-native run-android worked for me. I just waited library installings, after that it worked.



回答6:

 sudo sysctl -w fs.inotify.max_user_instances=1024
 sudo sysctl -w fs.inotify.max_user_watches=100000

you can try this bunch of line in your terminal. Just increase the max_user_watches number and it worked for me.



回答7:

Enter the ios sub-directory and run a pod install:

cd ./ios
pod install

Then, in the main project directory, run react-native run-ios.



回答8:

This problem can also be caused if you changed the jsCodeLocation to use a static bundle in AppDelegate.m for a release build and didn't change it back to the local settings.

https://facebook.github.io/react-native/docs/running-on-device.html#3-configure-app-to-use-static-bundle



回答9:

Shake your device, on the menu, select enable live reload and enable hot reload



回答10:

This could be one of the reasons, Try with uninstalling the app from device/emulator/simulator and re-run the command



回答11:

Make sure both your device and your laptop are on the same wi-fi network. My phone was on LTE and my laptop was on my regular wi-fi.



回答12:

Please try below actions if you created your app with react-native init YOUR_APP_NAME and are using android studio with AVD simulator.

  1. Make sure that your network is not firewall protected. If it is, the wifi in your simulator does not work (at least for me). Try using other networks / mobile hotspot.
  2. Make sure that the simulator is using android version pie with API level 28 as mentioned in the react-native documentation.
  3. Open android studio and run the simulator.
  4. If you are in windows platform, run the code using react-native run-android instead of npm start
  5. If you are on mac, run the code using react-native run-ios instead of npm start
  6. Wait for few minutes. The application should open in your simulator after loading the dependencies.


回答13:

I solved this problem by going to Settings > Apps and Notifications > Show All Apps > The app im trying to start and then the three dots in the top right corner and uninstall for all users. Then i ran yarn run android again



回答14:

In my case I had proxy settings enabled on the Android emulator. I solved the problem by disabling the proxy settings.



回答15:

I also met with the same issue, then I used a version when creating the app in react CLI..

react-native init project_name --version x.xx.x
eg:react-native init project_name --version 0.49.0

or u can overcome this by installing a different nodeJS version



回答16:

I am somehow able to get this to work by going into a fresh chrome instance and going to either "localhost:8081" or your local ip:8081... somehow after about a minute or three it snaps out of it.



回答17:

if you on Ubuntu type in terminal

sudo sysctl -w fs.inotify.max_user_instances=1024
sudo sysctl -w fs.inotify.max_user_watches=100000
watchman shutdown-server

then type in terminal react-native start



回答18:

Restart everything, restart your laptop, then run the build command again, everything will work again.



回答19:

Add a line of code given below, in your android/app/build.gradle

implementation 'com.facebook.android:facebook-android-sdk:5.0.0'

along with gradle version 5.5.1 in gradle-wrapper.properties as:

distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-all.zip