React Native Troubleshooting
My React Native build fails with: 'FBSDKCoreKit/FBSDKCoreKit.h' file not found
This error is usually because the Facebook SDK expects that it's installed in the user's home directory, which can be problematic for hosted builds. To work around this requirement, follow these steps:
Check in the FacebookSDK to your repository. It can go anywhere, but the script below assumes it's added to
<repo-root>/vendor/FacebookSDK.Add an npm preinstall script to your package.json:
"scripts": {
...
"preinstall": "./npmpreinstall.sh"
}
npmpreinstall.shsymlinks~/Documents/FacebookSDKto your repo with the following code:
#!/bin/sh
if [ ! -L ~/Documents/FacebookSDK ]; then
echo 'Symlinking ~/Documents/FacebookSDK to Facebook SDK in repo'
ln -s $(cd ./vendor/FacebookSDK; pwd) ~/Documents/FacebookSDK
fi
- Make
npmpreinstall.shexecutable:
chmod u+x npmpreinstall.sh
My React Native build fails with "FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory"
The issue can be resolved by allocating more memory with the --max-old-space-size flag.
On Android, add the following to the project's build.gradle file:
project.ext.react = [
nodeExecutableAndArgs: ["node", "--max_old_space_size=8192"]
]
On iOS, in Xcode, select your target and go to the Build Phases tab, in the section Bundle React Native code and images, add the flag to the shell script:
export NODE_BINARY="'node --max_old_space_size=8192'
../node_modules/react-native/packager/react-native-xcode.sh"
Povratne informacije
Pošalјite i prikažite povratne informacije za