搜索
您的当前位置:首页正文

RN安卓打包内存溢出解决React Native build f

来源:二三娱乐

React Native build fails with "FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory"

可以通过使用--max-old-space-size标志分配更多内存来解决此问题。

在Android上,将以下内容添加到build.gradle文件中:
project.ext.react = [
    nodeExecutableAndArgs: ["node", "--max_old_space_size=8192"]
]
在iOS上,在Xcode中,选择目标并转到“Build Phases”选项卡,在“Bundle React Native code and images”部分中,将标志添加到shell脚本:
export NODE_BINARY='node --max_old_space_size=8192'
../node_modules/react-native/packager/react-native-xcode.sh
Top