Firebase 模拟器无法启动并出现无意义的错误

mel*_*r55 3 firebase firebase-cli

我们使用模拟器已经有一段时间了。突然,他们停止在两个开发人员(但不是所有开发人员)的机器上工作。他们尝试调用firebase emulators:start,然后收到以下错误消息:Error: An unexpected error has occurred.

\n

我们真的不知道为什么会发生这种情况。我们甚至尝试重做 firebase init 和 emulators init。到目前为止,我们所做的一切尝试都没有帮助。以下是控制台输出以了解更多详细信息:

\n
\xe2\x9e\x9c  firebase git:(dev-vab) \xe2\x9c\x97 firebase emulators:start\ni  emulators: Starting emulators: functions, firestore, database, hosting, pubsub\n\xe2\x9a\xa0  functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: auth\n\xe2\x9a\xa0  Your requested "node" version "10" doesn't match your global version "14"\ni  firestore: Firestore Emulator logging to firestore-debug.log\ni  database: Database Emulator logging to database-debug.log\ni  hosting: Serving hosting files from: public\n\xe2\x9c\x94  hosting: Local server: http://0.0.0.0:5000\ni  pubsub: Pub/Sub Emulator logging to pubsub-debug.log\ni  ui: Emulator UI logging to ui-debug.log\ni  functions: Watching "/Users/isaacmartin/git_repos/firebase/functions" for Cloud Functions...\n\xe2\x9c\x94  functions[updateUser]: firestore function initialized.\n\xe2\x9c\x94  functions[handleEventInviteeCreation]: http function initialized (http://0.0.0.0:5001/likemindedly-stage/us-central1/handleEventInviteeCreation).\ni  emulators: Shutting down emulators.\ni  ui: Stopping Emulator UI\n\xe2\x9a\xa0  Emulator UI has exited upon receiving signal: SIGINT\ni  functions: Stopping Functions Emulator\ni  hosting: Stopping Hosting Emulator\ni  database: Stopping Database Emulator\ni  firestore: Stopping Firestore Emulator\ni  pubsub: Stopping Pub/Sub Emulator\ni  hub: Stopping emulator hub\ni  logging: Stopping Logging Emulator\n\nError: An unexpected error has occurred.\n\nHaving trouble? Try again or contact support with contents of firebase-debug.log\n
Run Code Online (Sandbox Code Playgroud)\n

现在,您会注意到我们确实检查了调试日志并发现了以下可能相关的内容:

\n
[debug] [2020-10-22T22:06:39.394Z] 15:06:39.394 [FirebaseWorkerPool-1-2] WARN com.firebase.core.namespace.NamespaceActorSystem - Request for ns: likemindedly-stage has incorrect domain. Current domain: 0.0.0.0, expected domain: firebaseio-staging.com\n {"metadata":{"emulator":{"name":"database"},"message":"15:06:39.394 [FirebaseWorkerPool-1-2] WARN com.firebase.core.namespace.NamespaceActorSystem - Request for ns: likemindedly-stage has incorrect domain. Current domain: 0.0.0.0, expected domain: firebaseio-staging.com\\n"}}\n[debug] [2020-10-22T22:06:39.448Z] <<< HTTP RESPONSE 404 {"content-length":"231","content-type":"application/json; charset=utf-8","access-control-allow-origin":"*","cache-control":"no-cache"}\n[debug] [2020-10-22T22:06:39.448Z] <<< HTTP RESPONSE BODY {\n  "correctUrl" : "https://likemindedly-stage.firebaseio-staging.com",\n  "error" : "Namespace likemindedly-stage lives in a different region. Please change your database URL to https://likemindedly-stage.firebaseio-staging.com"\n}\n
Run Code Online (Sandbox Code Playgroud)\n

它似乎在抱怨我们在配置中指向本地模拟器,但不清楚为什么这会成为问题?

\n

小智 5

就在几个小时前,我也遇到了这个问题。当我从 firebase.json 中删除主机时,它允许我正常启动模拟器,但我还没有弄清楚到底是什么导致了错误,或者如何在 json 文件之外正确设置主机。