question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Metro bundler doesn't start and/or doesn't generate bundle on iOS

See original GitHub issue

Environment

System: OS: macOS 10.14.6 CPU: (4) x64 Intel® Core™ i5-7360U CPU @ 2.30GHz Memory: 469.09 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 10.10.0 - ~/.nvm/versions/node/v10.10.0/bin/node Yarn: 1.15.2 - ~/.yarn/bin/yarn npm: 6.11.3 - ~/.nvm/versions/node/v10.10.0/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3 Android SDK: API Levels: 28, 29 Build Tools: 28.0.3, 29.0.2 System Images: android-28 | Google APIs Intel x86 Atom IDEs: Android Studio: 3.5 AI-191.8026.42.35.5791312 Xcode: 10.3/10G8 - /usr/bin/xcodebuild npmPackages: @react-native-community/cli: ^2.9.0 => 2.9.0 react: 16.8.6 => 16.8.6 react-native: 0.60.5 => 0.60.5 npmGlobalPackages: react-native-cli: 2.0.1 react-native-git-upgrade: 0.2.7

Description

I’m attempting to upgrade from react-native 0.59.10 to 0.60.5. When I run react-native run-ios, it builds the iOS app, but does not automatically start the metro bundler server.

If I do try to run the server manually before, it seems to work ok and gets to the point of Loading dependency graph, done. but then it does not actually seem to generate the bundle when the app opens up after installing, ie not seeing the green bar running through all the JS files.

Running react-native run-android it seems to start up the bundler ok though. I can’t tell yet if it’s generating the bundle as expected, still need to spend time on getting the dependencies up to date, but for right now, first just trying to get iOS up and running.

Updated

Edit: I’ve tested on node v10.16.3 and v12.9.1, but that does not make a difference unfortunately.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

31reactions
ger86commented, Oct 1, 2019

Add this script to your “Build Phases” of XCode in the third position

export RCT_METRO_PORT="${RCT_METRO_PORT:=8081}"
echo "export RCT_METRO_PORT=${RCT_METRO_PORT}" > "${SRCROOT}/../node_modules/react-native/scripts/.packager.env"
if [ -z "${RCT_NO_LAUNCH_PACKAGER+xxx}" ] ; then
  if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then
    if ! curl -s "http://localhost:${RCT_METRO_PORT}/status" | grep -q "packager-status:running" ; then
      echo "Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly"
      exit 2
    fi
  else
    open "$SRCROOT/../node_modules/react-native/scripts/launchPackager.command" || echo "Can't start packager automatically"
  fi
fi

2reactions
prakhar28commented, Sep 24, 2020

export RCT_METRO_PORT=“${RCT_METRO_PORT:=8081}” echo “export RCT_METRO_PORT=${RCT_METRO_PORT}” > “${SRCROOT}/…/node_modules/react-native/scripts/.packager.env” if [ -z “${RCT_NO_LAUNCH_PACKAGER+xxx}” ] ; then if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then if ! curl -s “http://localhost😒{RCT_METRO_PORT}/status” | grep -q “packager-status:running” ; then echo “Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly” exit 2 fi else open “$SRCROOT/…/node_modules/react-native/scripts/launchPackager.command” || echo “Can’t start packager automatically” fi fi

After doing this also it is not working in react native 0.62

Read more comments on GitHub >

github_iconTop Results From Across the Web

ReactNative Metro Bundler not starting automatically
Run react-native run-android --port 8084 in second Command Prompt window. After error screen appear clicking Android Ctrl + M , iOS Command +...
Read more >
react native metro bundler not starting : Solved Solution
react-native bundle --platform android --dev false --entry-file index.js -- bundle -output android /app/src/main/assets/index. android. bundle ...
Read more >
Reactnative Metro Bundler Not Starting Automatically - ADocLib
When I run Metro with npx react-native start --reset-cache , it runs on Metro bundler doesn't start and/or doesn't generate bundle on iOS...
Read more >
ReactNative Metro Bundler not starting automatically-React ...
... you need to delete two files(i.e. index.android.bundle and index.android.bundle.meta) b] If it doesn't exist, then create the assets directory in it.
Read more >
Words.txt
... andiroba andiron andirons andoke andor andorite andoroba andorobo andorra ... bundist bundists bundle bundled bundler bundlerooted bundlers bundles ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found