开启Hermes后React Native应用白屏怎么办?

传禄(打工版) 阅读 100

我刚在React Native项目里启用了Hermes引擎,结果iOS模拟器一运行就白屏,控制台也没报错。之前用JSC完全正常,是不是哪里配置漏了?

我试过clean build folder、重装node_modules,甚至新建了一个最小组件测试,还是白屏。下面是那个测试组件的代码:

import React from 'react';
import { View, Text } from 'react-native';

const App = () => {
  return (
    <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
      <Text>Hermes Test</Text>
    </View>
  );
};

export default App;
我来解答 赞 9 收藏
二维码
手机扫码查看
2 条解答
令狐朝炜
遇到这种情况先检查一下 Hermes 是否正确启用。确保在 ios/Podfile 里有 use_hermes! 这一行,然后 pod install。接着检查 package.json 里的引擎配置:

pre class="pure-highlightjs line-numbers">
"engines": {
"hermes-engine": "^0.11.0"
}


有时候 Hermes 的版本和 React Native 版本不匹配也会导致问题。确保两者兼容。还有就是清理缓存,尝试下这个命令:


watchman watch-del-all && rm -rf node_modules && yarn cache clean && yarn install && cd ios && pod install && cd ..


最后,确保 Xcode 使用的是最新版,有时候 IDE 的 bug 也会导致这种奇怪的问题。复制过去试试,希望这些步骤能解决你的问题。
点赞
2026-03-22 18:04
Mr.佳宜
Mr.佳宜 Lv1
试试这个 在ios/Podfile里加一行 pod 'hermes-engine', :path => '../node_modules/hermes-engine' 然后重新pod install
点赞
2026-03-20 18:00