react-native run-ios can not find any simulator

别说谁变了你拦得住时间么 提交于 2019-11-28 08:33:17
eric f.

I've found a temporary fix:

In the following file:

/node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js

...change line 42 to:

if (!version.startsWith('com.apple.CoreSimulator.SimRuntime.iOS') && !version.startsWith('tvOS')) {

Update

It is fixed in v1.9.8.

Update cli is the easy solution

npm install -g react-native-cli@latest

This issue is fixed but not released yet. https://github.com/react-native-community/react-native-cli/pull/274

So it can be solved temporarily to fix the file below.

/node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js

Change this line

if (!version.startsWith('iOS') && !version.startsWith('tvOS')) {

to

if (!version.includes('iOS') && !version.includes('tvOS')) {

Do not forget apply this again when you reinstall packages.

Try this script from Terminal

sed -i '' 's/startsWith/includes/g' node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js

Now run

react-native run-ios

Just do

npm install

Then it will show warnings, then fix them by using following command

npm audit fix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!