小编cap*_*kal的帖子

Metro 遇到错误:尝试解析模块“firebase”时

启动模拟器后出现此错误,我在图像下添加代码并在终端上出错。这是我的 App.js 文件 在模拟器上的错误图像

错误:错误:尝试firebase从文件解析模块时,已成功找到/Users/capcapbakkal/Desktop/RNKurs/identifyVerification/index.js包。/Users/capcapbakkal/Desktop/RNKurs/identifyVerification/node_modules/firebase/package.json然而,这个包本身指定了一个main无法解析的模块字段(/Users/capcapbakkal/Desktop/RNKurs/identifyVerification/node_modules/firebase/index。事实上,这些文件都不存在:

import firebase from 'firebase/compat/app';
import 'firebase/compat/auth';
import 'firebase/compat/firestore';
Run Code Online (Sandbox Code Playgroud)

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

  }
Run Code Online (Sandbox Code Playgroud)

node-modules firebase reactjs react-native firebase-authentication

3
推荐指数
1
解决办法
7534
查看次数