gpt4 book ai didi

reactjs - Metro 遇到错误 : While trying to resolve module 'firebase'

转载 作者:行者123 更新时间:2023-12-05 01:05:45 30 4
gpt4 key购买 nike

我在启动模拟器后遇到了这个错误,我在图像下添加了我的代码,并在终端上出现了错误。这是我的 App.js 文件 Error Image on Emulator

error: Error: While trying to resolve module firebase from file /Users/capcapbakkal/Desktop/RNKurs/identifyVerification/index.js, the package /Users/capcapbakkal/Desktop/RNKurs/identifyVerification/node_modules/firebase/package.json was successfully found. However, this package itself specifies a main module field that could not be resolved (/Users/capcapbakkal/Desktop/RNKurs/identifyVerification/node_modules/firebase/index. Indeed, none of these files exist:

import firebase from 'firebase/compat/app';
import 'firebase/compat/auth';
import 'firebase/compat/firestore';

componentDidMount() {
const firebaseApp = initializeApp({
apiKey: "AIzaSyCpM2dwcUvJqVaKz856hz",
authDomain: "authentication-b4",
projectId: "authen",
storageBucket: "authenticat",
messagingSenderId: "7532",
appId: "1:753222",
measurementId: "G-"
});// I changed this, it isn't wrong

}

最佳答案

我在使用 expo 构建 React Native 应用时遇到了同样的问题

//package.json

"expo": "^44.0.0",
"firebase": "^9.8.1",
Metro has encountered an error: While trying to resolve module `idb` from file `/Users/cerebra/workspace/retailshake/recognizeReborn/node_modules/@firebase/app/dist/esm/index.esm2017.js`, the package `/Users/cerebra/workspace/retailshake/recognizeReborn/node_modules/idb/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/cerebra/workspace/retailshake/recognizeReborn/node_modules/idb/build/index.cjs`. Indeed, none of these files exist:

已修复为 downgrading firebase

//package.json

"firebase": "9.7.0",

关于reactjs - Metro 遇到错误 : While trying to resolve module 'firebase' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70398442/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com