HomeiOS DevelopmentLearn how to replace React Native default port?

Learn how to replace React Native default port?


I’m making an attempt to run a React Native app with Metro on a port aside from the default 8081 (e.g. 10000).

I’ve adopted the official React Native docs right here:
https://reactnative.dev/docs/troubleshooting#using-a-port-other-than-8081

Learn how to replace React Native default port?

From my mission root, I begin Metro like this:

yarn begin --port 10000

Metro begins up tremendous on port 10000.

Nevertheless, after I run the iOS app within the simulator from Xcode, I get this error:

No bundle URL current.

Be sure to're operating a packager server or have included a .jsbundle file in your utility bundle.

screenshot of app in simulator

In accordance with the docs, for iOS I ought to:

replace occurrences of 8081 to your chosen port in ios/__App_Name__.xcodeproj/mission.pbxproj.

The issue is: in my ios/__App_Name__.xcodeproj/mission.pbxproj file there are no occurrences of 8081 in any respect, so I’ve nothing to switch. Trying to find 8081 returns nothing.


What I’ve tried

  • Beginning Metro with yarn begin --port 10000

  • Cleansing the construct folder in Xcode and rebuilding the app

  • Restarting the iOS simulator

  • Looking the complete ios/ folder (together with mission.pbxproj) for 8081 → no matches discovered


Atmosphere

  • React Native: (model right here, e.g. 0.73.8)

  • Utilizing the React Native CLI (not Expo)

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments