简体   繁体   中英

How to run `npm react-native run-ios` after upgrading mac os and upgrading xcode?

I picked up a react-native project from 2018. I was able to get the app to work in a simulator by typing npm install; npx react-native run-ios npm install; npx react-native run-ios on a 2012 mac mini that had Xcode 9.0 installed.

However, the iPhone 11 was not available from the list of simulators. I read that I needed Xcode 11+ to get iPhone 11 simulator. So i upgraded my mac mini from OS 10.13 to OS 10.15, then I upgrade Xcode to version 12.0.

I loaded up the new Xcode and entered my Apple ID. I then went to terminal and typed npx react-native run-ios , but I got the error:

`instruments` is now deprecated in favor of 'xcrun xctrace' (see `man xctrace` for more information on its replacement)

Could not find iPhone 6 simulator

So then I ran the command rm -rf node_modules; npm install; rm -rf node_modules; npm install; , but then I got the error:

npm ERR! error: pathspec 'master' did not match any file(s) known to git

And trying to run npx react-native run-ios gives the error:

Command `run-ios` unrecognized. Make sure that you have run `npm install` and that you are inside a react-native project.

How do you make npx react-native run-ios to work?

i think your project choose IP6 is default simulator, to change it, Clone your project, in package.json change

"ios": "react-native run-ios --simulator="iPhone X""

then run: yarn ios

if not, open your project "yourproject.xcworkspace" with Xcode, and run it. 在此处输入图像描述

if the error persists, show your package.json for everyone to consider

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM