[@RNC/AsyncStorage]: NativeModule: AsyncStorage is null. error

Maliethy·2021년 3월 12일
0

React-Native Error

목록 보기
1/15

1. issue

AsyncStorage를 사용하는데 다음의 에러가 발생했다.

[Fri Mar 12 2021 16:19:36.270]  ERROR    Error: [@RNC/AsyncStorage]: NativeModule: AsyncStorage is null.

2. solution

Just close the Metro bundler and run react-native run-android or run-ios and it will be fixed.에서 제시한 다음 해결과정을 따라가며 해결했다.

To fix this issue try these steps:
• Run react-native link @react-native-async-storage/async-storage in the project root.
• Rebuild and restart the app.
• Run the packager with --reset-cache flag.
• If you are using CocoaPods on iOS, run pod install in the ios directory and then rebuild and re-run the app.

  1. 프로젝트 루트에서 다음 명령어 실행하기

react-native link @react-native-async-storage/async-storage

  1. app 재시작하기

  2. npm run ios --reset-cache 실행하기

  3. CocoaPods를 사용할 경우 ios폴더로 이동해 pod install하기

profile
바꿀 수 있는 것에 주목하자

0개의 댓글