cap*_*kal 3 node-modules firebase reactjs react-native firebase-authentication
启动模拟器后出现此错误,我在图像下添加代码并在终端上出错。这是我的 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)
我在使用 expo 构建 React Native 应用程序时遇到了同样的问题
//package.json
"expo": "^44.0.0",
"firebase": "^9.8.1",
Run Code Online (Sandbox Code Playgroud)
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:
Run Code Online (Sandbox Code Playgroud)
修复了降级 firebase
//package.json
"firebase": "9.7.0",
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7534 次 |
| 最近记录: |