엑스포를 사용해서 파이어베이스와 연동하려고 했는데 뭐가 자꾸 안되는지 아래와 같은 에러가 떴다.
구글링해보니 나와 같은 상황에 처한 사람이 스택오버플로우에 있었다.
[원문보기]
React-native bundling failure. ERROR MESSAGE: "While trying to resolve module 'idb'..... Indeed none of these files exist":
ERROR MESSAGE IN QUESTION: While trying to resolve module idb from file C:\Users\OG\Desktop\programming\react_native\mealstogo\MealsToGo2\node_modules\@firebase\app\dist\esm\index.esm2017.js, the p...
stackoverflow.com
요약하자면, firebase과 엑스포 버전 간 호환성 문제 때문에 엑스포에서 cjs 파일을 못 읽어서 발생한 에러고, 아래와 같이 파이어베이스를 다운그레이드 시켜주거나 cjs파일을 추가해주면 된다.
[해결1 : 파이어베이스 다운그레이드]
@yarn
yarn remove firebase
yarn add firebase@9.6.11
@npm
npm uninstall firebase
npm install firebase@9.6.11
[해결2 : 새로운 설정파일(metro.config.js) 추가]
const { getDefaultConfig } = require("@expo/metro-config");
const defaultConfig = getDefaultConfig(__dirname);
defaultConfig.resolver.assetExts.push("cjs");
module.exports = defaultConfig;
firebase undefined is not an object 해결방법
파이어베이스를 다운그레이드하고 바로 다음 에러 등장-☆
firebase undefined is not an object...
해결방법
firebaseConfig.js 파일의 파이어베이스가 임포트되어 있는 부분에
import * as firebase from 'firebase/app';
import "firebase/database";
import "firebase/storage";
firebase 뒤에 compat/을 추가해준다.
import firebase from "firebase/compat/app";
import "firebase/compat/database";
import "firebase/compat/storage";
원래대로 잘 나옴. ㅠ 휴
'앱 개발' 카테고리의 다른 글
[내일배움단] 앱개발 종합반 3주차 개발일지 (0) | 2022.05.26 |
---|---|
[VScode] 터미널 지우기 안될 때 해결 / terminal clear / terminal cls 해결방법 (0) | 2022.05.24 |
[react-native] TouchableOpacity안에 Text 가운데 정렬하기 (0) | 2022.05.09 |
[내일배움단] 앱개발 종합반 1주차 개발일지 (0) | 2022.05.04 |
[android] kotlin button background 색상 변경 (1) | 2022.01.07 |
댓글