발생한 에러
Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
위 에러의 해결책으로 stactoverflow 에서는 빌드시 발생하는 캐쉬를 정리할 것을 추천했다. 겸사겸사해서 캐쉬 삭제하는 방법을 정리해봤다.
시도할 방법 1 (npm /yarn)
npm 사용자라면
npm start -- --reset-cache
yran 사용자라면
react-native start --reset-cache
시도할 방법 2 (android )
android 폴더로 이동 한 뒤 아래 명령어 실행한다.
./gradlew clean
또는
cd android && ./gradlew clean && cd ..
또는

위 방법은 아래의 경우에 실행하는 것이 필수적입니다.
- react-native run-android로 android emulator 실행 전
- 상대방은 잘 빌드가 된다고 하는데 내 컴퓨터에서만 빌드가 잘 안되는 경우
타인이 작업하던 프로젝트를 다운 받아서 실행하자 할 때 유용하고 필수적 입니다. RN 내의 Android SDK의 경로가 전 작업자의 컴퓨터의 절대 경로로 지정되어 있는 경우가 많기 때문에 에러가 뜹니다.
시도할 방법 3 (IOS)
XCODE 에서
Xcode 상에서 Cmd + Shift + K 혹은 맨상단의 Product에서 clean
또는
터미널에서
rm -rf ~/Library/Developer/Xcode/DerivedData
//빌드 시 생성된 자료들 초기화. 어디서 실행하든 상관없음
위 두 방법은 빌드가 꼬이거나, 컴파일들에 문제가 생긴 경우 기존 빌드 결과 생성된 폴더들을 초기화 한다고 생각하시면 됩니다.
POD 에서
pod install //ios폴더 안에서 실행해야함
이 방법은 npm install 은 했지만 , pod install 을 누락한 경우 Xcode로 빌드 시에 ~.h 파일에서 문제가 생기게 됩니다. react-native run-ios로 simulator 실행 전에 꼭 pod install결과 초록색 명령어 들이 뜨면서 successful한지 확인해주세요.

'개발로그 > ReactNative' 카테고리의 다른 글
React Query 를 사용해보자. : useQuery (0) | 2023.01.25 |
---|---|
리스트를 표현하는 ScrollView VS FlatList 어느것을 써야하는가. (0) | 2023.01.24 |
** BUILD FAILED ** Unable to find expo in this project - have you run yarn / npm install yet? (0) | 2023.01.23 |
** BUILD FAILED ** SDK "iphoneos" cannot be located 해결방법 (xcode 설정 포함) (0) | 2023.01.22 |
알면 도움되는 기능들. 스타일 상속 / vscode 이모지 단축키 / .toLocaleString() 을 android 환경에서도 사용하기 (0) | 2023.01.20 |
BlurView 에서 intensive 적용안됨 또는 android/ios 모두 적용 하는 해결방법 (0) | 2023.01.19 |
[ReactNative] open api 로 데이터 가져오기 01 - using fetch() , useState() (0) | 2023.01.16 |
** BUILD FAILED ** pod 캐쉬 삭제 후 재설치 /ExpoModulesCore 업데이트 /xcode 다운그레이드 (0) | 2023.01.11 |
댓글