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.

How to change port on RN 61 for IOS?

See original GitHub issue

Description

Ok, I know that, in the official docs it says I have to use the port parameter.

But it also says that for IOS:

[…] update occurrences of 8081 to your chosen port in the node_modules/react-native/React/React.xcodeproj/project.pbxproj file

The problem is that here it says RN 60 removes “React.xcodeproj”.

My question is, then: What is the new way of changing ports, whitout React.xcodeproj?

I’m running bundler and react-native run-ios with --port=9000 but, of course, I’m getting this error:

An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2): Failed to install the requested application An application bundle was not found at the provided path.

Because somewhere, port :8081 is still hardcoded.

And no I can’t just kill what’s on port 8081. This is a corporate computer that has McAffee running on 8081 and this process won’t shut down 😦

React Native version:

“react”: “16.9.0”, “react-native”: “0.61.2”

macOS Catalina 10.15.7 Xcode 11.5

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. react-native start --port=9000
  2. react-native run-ios --port 9000

Expected Results

An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2): Failed to install the requested application An application bundle was not found at the provided path. Provide a valid path to the desired application bundle. Print: Entry, ":CFBundleIdentifier", Does Not Exist error Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier Print: Entry, ":CFBundleIdentifier", Does Not Exist

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8

github_iconTop GitHub Comments

2reactions
leepowellnbscommented, Jan 7, 2022

I have a temp fix (I’m not a Ruby dev so there’s probably a better way of doing this):

  1. Update Podfile to
post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)

    # Port fix
    installer.pods_project.build_configurations.each do |config|
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'].insert(0, "RCT_METRO_PORT=${RCT_METRO_PORT}")
    end
end
  1. Run pod install again
2reactions
pachukacommented, Mar 29, 2021

@safaiyeh - This isn’t working for me on react-native 0.64.0. via the --port=8082 flag specifically for the ios build.

react-native start --port=8082  // bundler appears to properly start on port 8082
react-native run-ios --port=8082  // doesn't work
react-native run-android --port=8082 // works fine

Looks like the issue for iOS stems from RCTDefines.h in node_modules/react-native/React/Base/RCTDefines.h

image

If I update the port here to 8082 then run the ios command, then things work properly on the custom port, but that kind of defeats the purpose of having the cli argument if we still need to manually edit files to get it to work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change Mail Server ports Apple iPhone X, XS, XR, 11 ...
Change Incoming and Outgoing Mail Server Port Settings on iPhone and iPad · 1. From the IOS Device's home screen, Tap Settings. ·...
Read more >
Release 15.3(3)JBB
Cisco IOS Software Configuration Guide for Cisco Aironet Access Points ... port, and configure the access point as a workgroup bridge.
Read more >
React native ERROR Packager can't listen on port 8081
First we have to verify that the port 8081 is listening or not. In Windows,. Open CMD and run the command to check...
Read more >
USB C Wall Charger, ITEHIL 100W 4-Port Fast PD ...
Buy USB C Wall Charger, ITEHIL 100W 4-Port Fast PD Charger, Portable Type C Charger with Foldable Plug for iPhone 12/12 Pro Max/AirPods ......
Read more >
Consumer Reports: Product Reviews and Ratings
Get unbiased ratings and reviews for 9000+ products and services from Consumer Reports, plus trusted advice and in-depth reporting on what matters most....
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