Skip to content
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 does not start automatically when calling react-native run-android #2155

Closed
tapz opened this issue Nov 2, 2023 · 13 comments
Closed

Comments

@tapz
Copy link

tapz commented Nov 2, 2023

Environment

System:
  OS: macOS 13.5.2
  CPU: (12) arm64 Apple M2 Max
  Memory: 1.67 GB / 96.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.17.1
    path: ~/.nvm/versions/node/v18.17.1/bin/node
  Yarn:
    version: 1.22.19
    path: /opt/homebrew/bin/yarn
  npm:
    version: 9.6.7
    path: ~/.nvm/versions/node/v18.17.1/bin/npm
  Watchman:
    version: 2023.10.02.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.13.0
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.0
      - iOS 17.0
      - macOS 14.0
      - tvOS 17.0
      - watchOS 10.0
  Android SDK:
    API Levels:
      - "34"
    Build Tools:
      - 34.0.0
    Android NDK: Not Found
IDEs:
  Android Studio: 2022.3 AI-223.8836.35.2231.10811636
  Xcode:
    version: 15.0/15A240d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 20.0.1
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 11.3.9
    wanted: ^11.3.9
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.6
    wanted: 0.72.6
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Description

When updated the cli to version 12 the Metro bundler does not start automatically anymore after react-native run-android. The app starts and works, but no Metro terminal window. Manually starting it with react-native start works just fine. Version 11.3.9 does not have this issue.

@tapz tapz added the bug report label Nov 2, 2023
@szymonrybczak
Copy link
Collaborator

Hey @tapz, you shouldn't upgrade CLI manually, but if you need to do it you must take into account that there'll be some edge cases or strange situations like this one. In CLI v12 we migrated cli-plugin-metro inside Core so all parts related to starting and controlling a dev server are living there. So probably after upgrading to 0.73 which is in 3rd Release Candidate right now, this will work probably.

Could you please try creating new project and say is bundler starting from run-android comamnd?

npx react-native init RN073RC3 --version 0.73.0-rc.3

PS. Also you can try upgrading to latest RC in your app but I don't recommend it at this point.

@tapz
Copy link
Author

tapz commented Nov 3, 2023

@szymonrybczak I have added the CLI manually because some workaround for an RN bug required it. Not sure if that has already been fixed and I could remove the dependency.

@szymonrybczak
Copy link
Collaborator

@taps Yeah, so just try removing this CLI dependencies from your project. Maybe try bumping react-native version to 0.73.0-rc.3 (as I said this is not recommended). Stable version of 73 will be release in this month.

@Maddumage
Copy link

Maddumage commented Dec 16, 2023

I have created a new React Native project using the latest React Native version (73). But It also has this issue.
I'm using Mac mini M2.

@robhogan
Copy link
Collaborator

The current issue is fixed by #2198 and will be included in RN 0.73.1, set for release next week.

@codewithsujeet
Copy link

try this solution and its works for me
step.1 start the new terminal and run these command
npm start
step.2 start one more new terminal and run these command
npm run android
metro load on terminal 1 where the npm start are run

@Shahzaib114
Copy link

For now, you can downgrade your version of react native to 0.72.9. most probably, metro working on this version

@usmanabid94
Copy link

I am also facing the same issue metro won't start automatically had to run the npm start command to run it on 0.72.4

@khurshidansarigeoai
Copy link

I am also facing same and i am using react native 0.73.6

@zcSkr
Copy link

zcSkr commented Apr 26, 2024

I am also facing same and i am using react native 0.74

@zeeshan-shabbir
Copy link

I am also facing same with react native 0.73.6 on ios only

@Masahito-I
Copy link

Masahito-I commented Jul 24, 2024

I tried to create the bare react native with the latest version 0.74.3.

The iOS app on the real device didn't connect to the metro server even if I used the command in the metro options.
I didn't update the code from the generated version with the cli command.

I had to create the archive to verify the app works or not.
But I couldn't debug due to that issue.
Is there any update on this?

@NikitaRuYou
Copy link

Hi everyone, face the issue with "react-native": "0.75.2".
Created new project from scratch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests