react-native run-ios无法找到任何模拟器 [英] react-native run-ios can not find any simulator

查看:245
本文介绍了react-native run-ios无法找到任何模拟器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直面临着一个问题,即无论我添加到--simulator参数中的模拟器如何,"react-native run-ios"都无法启动. XCode具有命令行工具"的正确位置

I have been facing an issue where 'react-native run-ios' can not start, regardless of the simulator I add to the --simulator argument. XCode has the correct location for the 'command line tools'

我总是收到错误消息: 找不到iPhone X模拟器

I am always getting the error: Could not find iPhone X simulator

Error: Could not find iPhone X simulator
    at resolve (/Users/eric/.../swim/node_modules/react-native/local-cli/runIOS/runIOS.js:149:13)
    at new Promise (<anonymous>)
    at runOnSimulator (/Users/eric/.../swim/node_modules/react-native/local-cli/runIOS/runIOS.js:134:10)
    at Object.runIOS [as func] (/Users/eric/.../swim/node_modules/react-native/local-cli/runIOS/runIOS.js:106:12)
    at Promise.resolve.then (/Users/eric/.../swim/node_modules/react-native/local-cli/cliEntry.js:117:22)

本机信息

>   React Native Environment Info:
>     System:
>       OS: macOS 10.14.2
>       CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
>       Memory: 6.76 GB / 32.00 GB
>       Shell: 3.2.57 - /bin/bash
>     Binaries:
>       Node: 10.15.0 - /usr/local/bin/node
>       Yarn: 1.13.0 - /usr/local/bin/yarn
>       npm: 6.4.1 - /usr/local/bin/npm
>     SDKs:
>       iOS SDK:
>         Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
>     IDEs:
>       Android Studio: 3.1 AI-173.4819257
>       Xcode: 10.1/10B61 - /usr/bin/xcodebuild
>     npmPackages:
>       react: 16.6.3 => 16.6.3 
>       react-native: 0.57.8 => 0.57.8 
>     npmGlobalPackages:
>       create-react-native-app: 1.0.0
>       react-native-cli: 2.0.1
>       react-native-git-upgrade: 0.2.7

推荐答案

我找到了一个临时解决方法:

I've found a temporary fix:

在以下文件中:

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

...将第42行更改为:

...change line 42 to:

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

这篇关于react-native run-ios无法找到任何模拟器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆