Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用react本机应用程序连接和测试firebase emulator的正确方法_Firebase_React Native_Google Cloud Firestore_Firebase Tools - Fatal编程技术网

使用react本机应用程序连接和测试firebase emulator的正确方法

使用react本机应用程序连接和测试firebase emulator的正确方法,firebase,react-native,google-cloud-firestore,firebase-tools,Firebase,React Native,Google Cloud Firestore,Firebase Tools,我正在使用firebase作为无服务器后端实现react本机应用程序。我在尝试将我的应用程序连接到firebase emulator时遇到一些错误。我在react native中使用包作为我的firebase模块。以下是我尝试过的几种方法: 片段1: const firebase = require('firebase/app'); const db = firebase.firestore(); db.settings({ host: 'localhost:8080', ssl: false

我正在使用firebase作为无服务器后端实现react本机应用程序。我在尝试将我的应用程序连接到firebase emulator时遇到一些错误。我在react native中使用包作为我的firebase模块。以下是我尝试过的几种方法:

片段1:

const firebase = require('firebase/app');
const db = firebase.firestore();

db.settings({ host: 'localhost:8080', ssl: false });
错误::

@firebase/firestore:,firestore(7.8.1):无法访问云firestore后端。连接失败1次。最近的错误:FirebaseError:[代码=不可用]:操作无法完成

片段2:

firebase.firestore().useEmulator("localhost", 8080);
错误::

TypeError:firebase.firestore().useEmulator不是函数。(在“firebase.firestore().useMulator(“localhost”,8080)”中,“firebase.firestore().useMulator”未定义)

您应该阅读,它提供了一些您可能会觉得有用的片段。具体来说,它看起来应该是
firestore.usemulator(“10.0.2.2”,8080)在firestore上不带括号