React Native 환경 세팅

정윤수·2022년 8월 22일
0

React Native 앱 기본 세팅

  • Expo CLI가 아닌 React Native CLI를 사용하여 앱 개발을 진행하였다.
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

react-native-cli 설치

iterm2 를 열어 전역으로 react-native-cli 를 설치해준다

sudo npm install --location=global react-native-cli

react-native 프로젝트 생성

npx react-native init frontend

xcode 설정

  • xcode를 통해 화면에 출력하기 위해 아래와 같이 설정해준다.
cd frontend/ios && pod install
cd ios
pod deintegrate
pod install
  • xcode 앱으로 이동하여 iphone 13(15.5)를 맞춰준다.
    (VSC 에서도 15.5버전의 emulator를 설치해줘야 한다)

발생한 에러

error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening frontend.xcodeproj.

원인: Xcode 앱을 실행할 때, build를 할 때 architecuture 를 제대로 빌드 할 수 없다.

해결: 생각해보니 architecture를 제대로 설치해준 적이 없어서 아래와 같이 architecuture를 설치 해줌으로써 해당 문제를 해결하였다.

sudo arch -x86_64 gem install ffi
cd frontend/ios
arch -x86_64 pod install

결과

  • vsc 내 터미널로 들어와 react-native 를 실행한다.
npm run ios

참고

https://reactnative.dev/docs/environment-setup

https://qnrjs42.blog/react-native/m1-arm64-setting
https://wiwi-pe.tistory.com/168

https://github.com/facebook/react-native/issues/34063

profile
https://www.youtube.com/watch?v=whoDs0KRc7k&t=1s

0개의 댓글

관련 채용 정보