錯誤:
error Unable to resolve module https://www.gstatic.com/firebasejs/9.1.3/firebase-app.js from xxx\node_modules\firebase\firebase-auth.js: https://www.gstatic.com/firebasejs/9.1.3/firebase-app.js could not be found within the project or in these directories:
node_modules
If you are sure the module exists, try these steps:
1. Clear watchman watches: watchman watch-del-all
2. Delete node_modules and run yarn install
3. Reset Metro's cache: yarn start --reset-cache
4. Remove the cache: rm -rf /tmp/metro-*
> 1 | import { _getProvider, _registerComponent, SDK_VERSION, registerVersion, getApp } from 'https://www.gstatic.com/firebasejs/9.1.3/firebase-app.js';
我嘗試過的:
- 遵循錯誤指示;沒變
- 關注一些類似的github問題
- 檢查了類似的計算器溢位問題
附加資訊:
- 我之前也遇到過類似的模塊決議錯誤,但大多數情況下,只需重新啟動 Metro 即可解決我的問題——有了這個問題,它并沒有消失。
我的代碼:
// Import the functions you need from the SDKs you need
import { initializeApp } from "firebase/app";
import { getAuth } from "firebase/auth"
import {
FIREBASE_API_KEY,
FIREBASE_AUTH_DOMAIN,
FIREBASE_PROJECT_ID,
FIREBASE_APP_ID,
FIREBASE_MESSAGING_SENDER_ID,
FIREBASE_STORAGE_BUCKET
} from "@env";
// https://firebase.google.com/docs/web/setup#available-libraries
const firebaseConfig = {
apiKey: FIREBASE_API_KEY,
authDomain: FIREBASE_AUTH_DOMAIN,
projectId: FIREBASE_PROJECT_ID,
storageBucket: FIREBASE_STORAGE_BUCKET,
messagingSenderId: FIREBASE_MESSAGING_SENDER_ID,
appId: FIREBASE_APP_ID
};
export const FirebaseApplication = initializeApp(firebaseConfig);
export const FireBaseAuthentication = getAuth(FirebaseApplication)
uj5u.com熱心網友回復:
您應該使用react-native-firebase庫并按照說明安裝它。
https://rnfirebase.io/
https://github.com/invertase/react-native-firebase
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/340272.html
