Metro server no longer runs automatically on certain startup commands
Environment
System:
OS: macOS 14.6
CPU: (16) arm64 Apple M3 Max
Memory: 18.09 GB / 48.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 22.8.0
path: ~/.asdf/installs/nodejs/22.8.0/bin/node
Yarn:
version: 1.22.22
path: ~/.asdf/shims/yarn
npm:
version: 10.8.2
path: ~/.asdf/plugins/nodejs/shims/npm
Watchman:
version: 2024.09.30.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.12.1
path: /Users/tylerwilliams/.asdf/shims/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.0
- iOS 18.0
- macOS 15.0
- tvOS 18.0
- visionOS 2.0
- watchOS 11.0
Android SDK: Not Found
IDEs:
Android Studio: 2024.2 AI-242.21829.142.2421.12409432
Xcode:
version: 16.0/16A242d
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.12
path: /usr/bin/javac
Ruby:
version: 3.3.4
path: /Users/tylerwilliams/.asdf/shims/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.3.1
wanted: 18.3.1
react-native:
installed: 0.75.3
wanted: 0.75.3
react-native-macos:
installed: 0.75.6
wanted: ^0.75.0-0
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false
Description
I first noticed this while working in an out-of-tree platform, React Native MacOS. Running npx react-native run-macos did not start Metro automatically. Filed the full set of details originally in their project at https://github.com/microsoft/react-native-macos/issues/2208
But I got a notificaiton about the "removing run on iOS/Android key handlers" discussion about this comment: https://github.com/react-native-community/discussions-and-proposals/discussions/821#discussioncomment-10852786
not opposed to this change (alongside the above, it also seems less confusing to only have one entry point), but I do want to note that, at least for me, yarn android doesn't seem to start Metro? I'm using Ubuntu 24.04/GNOME Terminal if it matters - I swear it did work (at least occasionally) on Windows but I'm not certain about that
And I thought it might be related to what I had seen on React Native MacOS.
Reproducible Demo
Follow the React Native macOS setupd (for the most part, the current docs are actually a little out of date, but this will be the steps for an up-to-date RN project)
- npx @react-native-community/cli init macapp
- cd macapp
- npx react-native-macos-init
- npx react-native run-macos
The app will build, but not start Metro:
Not a big deal, I can just run yarn start, then tap "reload"
Everything works great from there. I also did not have this issue when following the instructions for RN 0.71:
npx react-native@latest init <projectName> --version 0.71.0
Reproducer repo: https://github.com/coolsoftwaretyler/rnms-issue-repro
It sounds like this is happening on in-tree platforms as well based on @Rexogamer's comment in that discussion post, but I don't have a reproduction for that at the moment.
Thanks for your work and consideration!