簡體   English   中英

firebase 命令在 vs 代碼終端 800a03ea 錯誤中不起作用

[英]firebase commands not working in vs code terminal 800a03ea error

在終端中運行 firebase 初始化函數時出現此錯誤

這是我用來調用 firebase 的 firebase.js 代碼:

import * as firebase from '@firebase/app' //line 1 which seems to cause the error
//imports for webonly
const Firebase = firebase.initializeApp(firebaseConfig);
export default Firebase

我還嘗試從“firebase”和“react-native-firebase/app”導入 firebase,但是當嘗試在 firebase 中使用雲函數時,在鏈接中的函數中出現錯誤

如果有人可以提供幫助,將不勝感激。 謝謝你。 另外,如果重要的話,我在 expo 中使用 react-native

編輯:所有 firebase 命令都不起作用並給出相同的錯誤 這是錯誤:SyntaxError: Cannot use import statement outside a module

依賴項:

{ "main": "node_modules/expo/AppEntry.js", "scripts": { "start": "expo start", "android": "expo start --android", "ios": "expo start --ios", "web": "expo start --web", "eject": "expo eject" }, "dependencies": { "@firebase/auth": "^0.14.3", "@firebase/messaging": "^0.6.13", "@react-native-community/masked-view": "0.1.5", "@react-native-firebase/app": "^6.4.0", "@react-native-firebase/messaging": "^6.4.0", "@react-navigation/compat": "^5.1.7", "@react-navigation/drawer": "^5.3.4", "@react-navigation/native": "^5.1.4", "@react-navigation/stack": "^5.2.1", "expo": "~36.0.0", "expo-background-fetch": "~8.0.0", "expo-task-manager": "^8.1.0", "fcm-node": "^1.5.2", "firebase": "^7.14.1", "firebase-admin": "^8.10.0", "firebase-functions": "^3.6.0", "native-base": "^2.13.8", "path": "^0.12.7", "react": "~16.9.0", "react-dom": "~16.9.0", "react-native": "https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz", "react-native-filesystem": "^0.1.0", "react-native-fs": "^2.16.6", "react-native-gesture-handler": "~1.5.0", "react-native-paper": "^3.6.0", "react-native-reanimated": "~1.4.0", "react-native-safe-area-context": "0.6.0", "react-native-screens": "2.0.0-alpha.12", "react-native-web": "~0.11.7", "react-navigation-material-bottom-tabs": "^2.2.6", "react-redux": "^7.2.0", "redux": "^4.0.5", "redux-thunk": "^2.3.0" }, "devDependencies": { "babel-preset-expo": "~8.0.0", "@babel/core": "^7.0.0" }, "private": true }

解決方案:我不確定這是否有資格獲得答案,但通過設置默認 shell git BASH 我能夠執行命令

您可以按以下方式導入:

import * as firebase from 'firebase';

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM