Fixing “:CFBundleIdentifier, Does Not Exist” Error in React Native iOS build

After spending a couple of hours trying to debug this issue, I thought I would write about the solution that worked for me. Here are some of the possible solutions I found on the web –

  1. Make sure 8081 port is free and not taken by any application. On Mac you can check this by running command lsof -i :8081. If any process is running then kill it – kill -9 <pid>
  2. Remove spaces from the folder path of the project
  3. Run react-native upgrade in the project folder

In my case the problem was #1. However simple lsof command did not show any process. But sudo lsof -i :8081did show the process. It turned out that McAfee agent was running on the same port. Killing the agent is not an option for me. So the next thing to do was find a way to change the port of Ract-Native packager.

Following steps worked for me –

  1. Opne node_modules/react-native/local-cli/server/server.js and change port 8081 to the port you want to run the packager on. In the version of React-Native I am using, it is in the following code –
    module.exports = {
      name: 'start',
      func: server,
      description: 'starts the webserver',
      options: [{
        command: '--port [number]',
        default: 8090,
        parse: (val: string) => Number(val),
      },
    
  2. Change references to port 8081 in following files –
    1. node_modules/react-native/Libraries/Core/Devtools/getDevServer.js
    2. node_modules/react-native/React/React.xcodeproj
    3. node_modules/react-native/React/ReactLegacy.xcodeproj
    4. node_modules/react-native/React/Base/RCTBundleURLProvider.m

If above changes do not fix the problem, you may want to try replacing all references to port 8081 in the files in node_modules/react-native folder.

Wish Facebook makes changing packaging port easier than the above process.

-Ram Kulkarni

Social