React Native,IOS 模拟器打开模拟器时出错。检查 Metro 日志以了解详细信息
React Native, IOS Simulator Error opening simulator. Check Metro log for details
所以这是我的问题。
我刚刚在我的 M1 macbook air 上创建了一个 React native 项目,一个空白项目。
yarn 开始工作正常,但是当我想用 IOS 模拟器打开时,我遇到了这个错误:“错误打开模拟器检查 metro 日志以获取详细信息”
此外,当我尝试在 VS 代码中直接打开 ios 模拟器时(纱线启动后的磁带 i),我有:
Opening on iOS...
Opening the iOS simulator, this might take a moment.
(node:2690) UnhandledPromiseRejectionWarning: Error: open exited with non-zero code: 1
at ChildProcess.completionListener (/usr/local/lib/node_modules/expo-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:65:13)
at Object.onceWrapper (events.js:422:26)
at ChildProcess.emit (events.js:315:20)
at maybeClose (internal/child_process.js:1048:16)
at Socket. (internal/child_process.js:439:11)
at Socket.emit (events.js:315:20)
at Pipe. (net.js:673:12)
...
at spawnAsync (/usr/local/lib/node_modules/expo-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:26:19)
at Object.openSimulatorAppAsync (/@expo/xdl@59.0.14/src/SimControl.ts:308:16)
at ensureSimulatorOpenAsync (/@expo/xdl@59.0.14/src/Simulator.ts:185:22)
at Object.openProjectAsync (/@expo/xdl@59.0.14/src/Simulator.ts:674:14)
at ReadStream.handleKeypress (/usr/local/lib/node_modules/expo-cli/src/commands/start/TerminalUI.ts:228:11)
(Use node --trace-warnings ...
to show where the warning was created)
(node:2690) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)
(node:2690) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
因此,如果有人有线索,我尝试更改 .expo 用户名:“sudo chown -R MYUSERNAME /Users/MYUSERNAME/.expo/”(显然它为其他人解决了这个问题,但没有我..
在此先感谢,我刚刚开始使用 React Native,并且从这种错误开始它非常令人沮丧。
更新:问题由 运行 解决:expo client:install:ios
所以这是我的问题。
我刚刚在我的 M1 macbook air 上创建了一个 React native 项目,一个空白项目。
yarn 开始工作正常,但是当我想用 IOS 模拟器打开时,我遇到了这个错误:“错误打开模拟器检查 metro 日志以获取详细信息”
此外,当我尝试在 VS 代码中直接打开 ios 模拟器时(纱线启动后的磁带 i),我有:
Opening on iOS... Opening the iOS simulator, this might take a moment. (node:2690) UnhandledPromiseRejectionWarning: Error: open exited with non-zero code: 1 at ChildProcess.completionListener (/usr/local/lib/node_modules/expo-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:65:13) at Object.onceWrapper (events.js:422:26) at ChildProcess.emit (events.js:315:20) at maybeClose (internal/child_process.js:1048:16) at Socket. (internal/child_process.js:439:11) at Socket.emit (events.js:315:20) at Pipe. (net.js:673:12) ... at spawnAsync (/usr/local/lib/node_modules/expo-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:26:19) at Object.openSimulatorAppAsync (/@expo/xdl@59.0.14/src/SimControl.ts:308:16) at ensureSimulatorOpenAsync (/@expo/xdl@59.0.14/src/Simulator.ts:185:22) at Object.openProjectAsync (/@expo/xdl@59.0.14/src/Simulator.ts:674:14) at ReadStream.handleKeypress (/usr/local/lib/node_modules/expo-cli/src/commands/start/TerminalUI.ts:228:11) (Use
node --trace-warnings ...
to show where the warning was created) (node:2690) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4) (node:2690) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
因此,如果有人有线索,我尝试更改 .expo 用户名:“sudo chown -R MYUSERNAME /Users/MYUSERNAME/.expo/”(显然它为其他人解决了这个问题,但没有我..
在此先感谢,我刚刚开始使用 React Native,并且从这种错误开始它非常令人沮丧。
更新:问题由 运行 解决:expo client:install:ios