Skip to content

Packager very slow on first run #11457

@ywongweb

Description

@ywongweb

Description

When I runreact-native run-ios, the package takes a very long time(2-3 minutes on a brand new init project) to run /bin/sh -c /Users/username/dev/myapp/ios/build/Build/Intermediates/myapp.build/Debug-iphonesimulator/myapp.build/Script-F8DA82EA1DF9468900363441.sh.

Observations

  • The slowdown only happens when I don't have the packager running already. If it's running, subsequent react-native run-ios is very fast.
  • There is no slowdown if I run the packager and reset it's cache node_modules/react-native/packager/packager.sh --reset-cache. But I have do the reset every time, also I need to manually refresh the iOS simulator twice to see the app.
  • The slow down is happening even with a newly init react-native project (react-native 0.39.2), also happens on projects with older versions of react-native.
  • I've tried removing node_modules, cleaning npm cache with npm cache clean, reinstalling watchman and react-native cli. Non of these work.

Additional Information

content of Script-F8DA82EA1DF9468900363441.sh

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions