MacOS Monterey 12.4
Xcode 13.4.1
brew 3.5.9
node 16.15.1
npm 8.11.0
watchman 2022.08.15.00
react-native-cli 2.0.1
pod 1.11.3
openjdk 11.0.11
javac 11.0.11
아이폰 라이브러리를 다운받기 위해 iterm2 내에서 cocoapods를 설치해준다.
sudo gem install cocoapods
cli 설치 전 캐시를 한 번 비워준다
( 이전에 Xcode를 한 번 잘못 만졌던 기억이 있어서 난 지워줬다)
pod cache clean --all
yarn cache clean
rm -rf ~/Library/Developer/Xcode/DerivedData/*
sudo npm install --location=global react-native-cli
현재 새로 나온0.69.0 버전은 오류가 계속 잡혀서 0.68.2 버전을 설치 해준다
npx react-native init [프로젝트명] --version 0.68.2
Xcode 앱을 실행할 때, build를 할 때 M1 architecuture 는 cocoapods과 직접 호환 되지 않기 때문에 아키텍처를 설치해준다
cd /[프로젝트명/ios
sudo arch -x86_64 gem install ffi
arch -x86_64 pod install
pod install
혹시나 pod 설치에 버전 오류가 날시
cd ios
pod deintegrate
pod install
sudo npm uninstall --location=global react-native-cli
vi ~/.bash_profile
원인: Xcode 앱을 실행할 때, build를 할 때 M1 architecuture 는 cocoapods과 직접 호환 되지 않는다.
해결: 아래와 같은 패키지를 설치해서 동적으로 연결된 라이브러리를 로드하고 올바르게 ffi 실행할 수 있도록 한다.
sudo arch -x86_64 gem install ffi
cd frontend/ios
arch -x86_64 pod install
적절한 architecuture로 실행
cd /frontend/ios
pod install
https://reactnative.dev/docs/environment-setup
https://qnrjs42.blog/react-native/m1-arm64-setting
https://wiwi-pe.tistory.com/168
https://stackoverflow.com/questions/72733254/why-react-native-cli-giving-errors
https://github.com/facebook/react-native/issues/34063https://qnrjs42.blog/react-native/m1-arm64-setting
https://velog.io/@eojine94/MAC-M1-React-Native-개발-환경-구축-및-에러-해결