React Native build fails with "FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory"
可以通過使用--max-old-space-size標志分配更多內(nèi)存來解決此問題。
在Android上,將以下內(nèi)容添加到build.gradle文件中:
project.ext.react = [
nodeExecutableAndArgs: ["node", "--max_old_space_size=8192"]
]
在iOS上,在Xcode中,選擇目標并轉(zhuǎn)到“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