-
Notifications
You must be signed in to change notification settings - Fork 904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Metro Bundler immediately closes after react-native run-android #484
Comments
We'll need help debugging what's causing this. What does it mean that "it closes"? Can you share more details? |
@thymikee well I can't see the error on it as it only blinks. How can I debug it? Edit: after looking really closely, the Metro Bundler window is completely empty when it closes, so no error there. |
Can you post a video? :D Set up some console.logs in |
@thymikee runServer gives nothing so it's not even getting there. |
Btw, does running |
Running |
Doing |
Running |
Yea, because we removed this option. It's not necessary now. Can you remove it from https://github.com/facebook/react-native/blob/master/scripts/launchPackager.bat and see if that works? |
@thymikee yup. Working without a hitch. |
Yea, can you send a PR to RN? The patch release make take a while (cc @kelset). I think we should own these files, but that may be a bit bigger change. |
@thymikee okay, I will do that. |
removing node_modules/react-native/scripts/launchPackager.bat then even the splash window of Metro Bundler will not show, of course it's not running. |
@zenz it's not about rmeoving the file, but doing this diff: -node "%~dp0..\cli.js" --projectRoot ../../../ start
+node "%~dp0..\cli.js" start |
@thymikee oops... yes, it's working now. |
@thymikee can't we ship a temporary fix with the cli until RN releases the fix? |
If you'd like to contribute this then of yea. I don't have too much bandwidth currently, just trying to be helpful. |
It seems that another problem raised after modify this launchPackager.bat file. Metro Bundler tells me there's no index file |
@zenz same here. I changed |
Maybe |
modify it like this, solves the problem:
hard coding it to swith to root directory. |
I think that makes sense, this is similar to what Linux script does: https://github.com/facebook/react-native/blob/master/scripts/launchPackager.command |
@thymikee should I add it to the PR? |
Let's make sure it works as intended, and then yes |
I was using node 12.13.0 and facing the same issue. Now I downgraded it to 10.15.0 and metro bundle is running without fail. |
It worked for me. Thanks |
Thanks It worked for me. running 13.1.0 not worked. downgraded to 12.4.0 and it worked. :) |
I also downgraded to 12.4.0 and it worked If you are using chocolatey on windows
|
Same here, downgrading node from v12.13.1 to 12.4.0 to work |
I have the same issue with version 3.0.4, which is the latest right now, should I open a new issue? |
Confirmed that it's working aswell. |
where can i find the file to modify |
nodemodules/react-native/scripts/launchPackager.bat |
Actually, this work for me. |
Open Your Project Folder in IDE like Visual Studio Code etc Click on node_modules folder Click on metro-config folder Click on src folder Click on default folder Open blacklist.js file and replace the following code |
guys any other solution? System: I really need this fix. Any quick help would appreciate it |
What is the status of this? I'm still experiencing this error, the metro bundle closing with running |
In my case I intentionally uninstalled app from emulator and faced the issue. Tried all options but changing app name is the best option. Else reinstall android studio with a new emulator. |
Try changing app name in app.Json, build.gradle, AndroidManifest.xml in both debug and main folders |
In mac env I also had the same issue and the solution was: |
I'm using node v16.3.0 and this adjustment you posted made it work.. tks |
For me it was because I had "type": "module" in my package.json |
I was having this issue but wasn't able to resolve it with any of the earlier solutions. In the end it turned out my computer had a process binding the default port. Running with a custom port worked great until I restarted, then things were back to normal.
|
i always this same problem and the error is usually some file in node_modules was unavailable, if i just continue to press play from android studio it eventually works but sometimes it takes up to 10 tries. any ideas ? |
@cparello Switch to Flutter for 100% guaranteed builds, Android and iOS, every single time! I got bored to fight the compiler, did the switch and never looked back! |
How is this still an issue? Its such a waste of time to compile the code from like 15th time because the metro keeps exiting when the build is at 95-99%. I updated the package but not fixed, tried various fixes from the comments above - nothing. |
I'm not too sure if this is the correct solution but opening an new console and running
works for me. |
I had the same issue.The Metro runs on port 8081.But something else running was running on the port.I resolved by killing that process.refer https://reactnative.dev/docs/troubleshooting for more info |
Was a permanent fix ever found for this problem, I'm still experiencing it. |
Hey @MattNic2, mind upgarding to the latest version of RN? We fixed few things around starting packager in |
For me, quitting the Docker solves my issue. |
Environment
Description
Doing
yarn react-native run-android
opens themetro bundler
but it immediately closes. Don't know if its a bug with thecli
or themetro
itself. This only happens on Windows, I think.Things I have tried:
Reproducible Demo
react-native init
yarn react-native run-android
The text was updated successfully, but these errors were encountered: