facebook / metro

🚇 The JavaScript bundler for React Native
https://metrobundler.dev
MIT License
5.24k stars 626 forks source link

React Native / Metro hangs after starting #1392

Open Supermarcel10 opened 4 days ago

Supermarcel10 commented 4 days ago

Do you want to request a feature or report a bug? BUG

What is the current behavior? React Native / Metro seems to be stuck after running react-native start

If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can yarn install and yarn test. 1) Run react-native start --verbose

What is the expected behavior? Metro starts up as expected

Extra Info:

~/WebstormProjects/test git:[test]
react-native start --verbose

debug Using @react-naive-community/cli-tools' logger
debug Reading Metro config from /home/marcel/WebstormProjects/test/metro.config.js
info Welcome to React Native v0.76
~/WebstormProjects/test git:[test]
$ npx react-native info

info Fetching system and libraries information...
System:
  OS: Linux 6.6 NixOS 24.05 (Uakari) 24.05 (Uakari)
  CPU: (12) x64 AMD Ryzen 5 5600X 6-Core Processor
  Memory: 21.66 GB / 31.25 GB
  Shell:
    version: 5.2.32
    path: /run/current-system/sw/bin/bash
Binaries:
  Node:
    version: 20.15.1
    path: /run/current-system/sw/bin/node
  Yarn:
    version: 1.22.22
    path: /run/current-system/sw/bin/yarn
  npm:
    version: 10.7.0
    path: /run/current-system/sw/bin/npm
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
IDEs:
  Android Studio: Not Found
Languages:
  Java:
    version: 17.0.8
    path: /nix/store/mni9lkdmwgdyd8afafmawlrnshbl8zad-jetbrains-jdk-jcef-17.0.8-b1000.8/bin/javac
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.0
    wanted: 15.0.0
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.1
    wanted: 0.76.1
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: false

info React Native v0.76.2 is now available (your project is running on v0.76.1).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.76.2
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.76.1&to=0.76.2
info For more info, check out "https://reactnative.dev/docs/upgrading?os=linux".
~/WebstormProjects/test git:[test]
$ react-native --version

15.0.0
Supermarcel10 commented 3 days ago

With further investigation, this seems to be an issue with --verbose. The created node process gets stuck for some reason, and cannot be killed with kill -9.

Supermarcel10 commented 3 days ago

It seems to be overall an issue with metro hanging mostly all the time - when running, starting and stopping. Because it's unable to stop, it hangs when attempting to start. It seems to hang on stopping because it hangs during when it runs.

 (NOBRIDGE) LOG  Bridgeless mode is enabled
 (NOBRIDGE) LOG  Running "untitled" with {"rootTag":11,"initialProps":{},"fabric":true}
 INFO  
 💡 JavaScript logs will be removed from Metro in React Native 0.77! Please use React Native DevTools as your default tool. Tip: Type j in the terminal to open (requires Google Chrome or Microsoft Edge).
 BUNDLE  ./index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1)
 BUNDLE  ./index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1)info Stopping server
^C^C^C^C^C
~/WebstormProjects/test git:[test]
$ react-native start

info Welcome to React Native v0.76
robhogan commented 3 days ago

Hi @Supermarcel10 - could you check whether you experience the same issue in an Expo CLI project? If not, this is likely an issue with the community CLI rather than Metro.

In any case, we'd need a reproduction (ideally a minimal project in a github repo) to look into this further - we haven't had any other reports and there's not much I can suggest without a repro.

You can try DEBUG=Metro:* for more verbose logging of Metro internals.