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.

Unable to Run RN 0.59 CLI's 'run-ios' on xCode 13

See original GitHub issue

I am maintaining an app that still runs on react native 0.59. I recently upgraded my MacBook to Big Sur, and now I am getting issues attempting to run my react native app that is on 0.59.10. Our script in package.json to run a version of our iOS app looks like:

"ios-debug": "node node_modules/react-native/local-cli/cli.js run-ios"

I am getting the following error after upgrading to Big Sur and xCode 13:

info Found Xcode workspace {APPNAME}.xcworkspace
xcrun: error: Failed to locate 'instruments'.
xcrun: error: unable to find utility "instruments", not a developer tool or in PATH
error Command failed: xcrun instruments -s
xcrun: error: Failed to locate 'instruments'.
xcrun: error: unable to find utility "instruments", not a developer tool or in PATH

I see this tool (instruments) has been removed now. Since @react-native-community/cli is a transitive library that react-native includes itself, how do I go about using a newer version of the CLI tools? I attempted to install @react-native-community/cli-platform-ios to see if that would get me anywhere, but I had no luck finding a replacement to the node node_modules/react-native/local-cli/cli.js run-ios that the ios-debug script runs. Does anyone have any advice? We are in the middle of upgrading said app, but we would really like to continue make changes to our existing app until our updated app is ready. Any help is really appreciated, thank you!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:16
  • Comments:6

github_iconTop GitHub Comments

11reactions
devxoulcommented, Oct 1, 2021

Short answer

Upgrade react-native to 0.64.0.

Long answer

Since Xcode 13 $ xcrun instruments is not available any more. There is a patch to use xctrace over instruments and included in @react-native-community/cli 5.0.1-alpha.1. react-native supports this cli version since v0.64.0.

9reactions
rukeefancommented, Sep 24, 2021

I just spent my all night and found a solution, that error happed because Xcode 13 removed instruments. So the solution is to avoid to run instruments. replace your runIOS function in runIOS.js file(/node_modules/react-native/local-cli/runIOS/runIOS.js )


function runIOS(argv, config, args) { if (!fs.existsSync(args.projectPath)) { const reactNativeScriptsPath = findReactNativeScripts(); if (reactNativeScriptsPath) { child_process.spawnSync( reactNativeScriptsPath, [‘ios’].concat(process.argv.slice(1)), {stdio: ‘inherit’}, ); return; } else { throw new Error( ‘iOS project folder not found. Are you sure this is a React Native project?’, ); } } process.chdir(args.projectPath); const xcodeProject = findXcodeProject(fs.readdirSync(‘.’)); if (!xcodeProject) { throw new Error(‘Could not find Xcode project files in ios folder’); }

const inferredSchemeName = path.basename( xcodeProject.name, path.extname(xcodeProject.name), ); const scheme = args.scheme || inferredSchemeName; console.log( Found Xcode ${xcodeProject.isWorkspace ? 'workspace' : 'project'} ${ xcodeProject.name }, );/* const devices = parseIOSDevicesList( child_process.execFileSync(‘xcrun’, [‘instruments’, ‘-s’], { encoding: ‘utf8’, }), ); if (args.device) { const selectedDevice = matchingDevice(devices, args.device); if (selectedDevice) { return runOnDevice( selectedDevice, scheme, xcodeProject, args.configuration, args.packager, args.verbose, args.port, ); } else { if (devices && devices.length > 0) { console.log( ‘Could not find device with the name: "’ + args.device + ‘".’, ); console.log(‘Choose one of the following:’); printFoundDevices(devices); } else { console.log(‘No iOS devices connected.’); } } } else if (args.udid) { return runOnDeviceByUdid(args, scheme, xcodeProject, devices); } else {*/ return runOnSimulator(xcodeProject, args, scheme); //} }


then start debug with specific simulator: react-native run-ios --simulator “iPhone X”

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot Run RN 0.59 CLI's 'run-ios' on xCode 13 #1474 - GitHub
I am maintaining an app that still runs on react native 0.59. I recently upgraded my MacBook to Big Sur, and now I...
Read more >
Xcode 13 cannot run project genera… - Apple Developer
Press Run and see how it builds and runs on your device. Now open the same project with Xcode 13. Press Run and...
Read more >
Unable to build react native project after updating to xcode 11.0
If I install xcode 10.3 and run the command react-native run-ios , it still works. Hope the issue is clear. Any fixes for...
Read more >
failed to build ios project. we ran "xcodebuild" command but it ...
React native app won't run after updating to latest version RN 0.64.0 ... React-Native CLI run-ios script attempts to run app on non-existent...
Read more >
Upgrading React Native to version 0.59 and beyond: a step-by ...
While the semi-automated copy-and-replace mechanism works well if you didn't touch any of your project's native code, you may run into issues if ......
Read more >

github_iconTop Related Medium Post

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