Firebase-tools: firebase-cli 上没有本地模拟器套件

创建于 2020-06-11  ·  3评论  ·  资料来源: firebase/firebase-tools

不要删除 validate_template=true template_path=.github/ISSUE_TEMPLATE/bug_report.md 感谢您为 Firebase 社区做出贡献! md5-4f584446c02c091fc1cc63786b0a4438 是的,我们绝对不完美! 请使用此模板并在打开问题时包含一个最小的重现。 如果您知道如何解决问题,请创建一个拉取请求,我们很乐意对其进行审核! md5-05a0c106e15ca89a73bafbf6cfe51156 太好了,我们喜欢听到如何改进我们的产品! 但是,请勿使用此模板提交功能请求。 请将您的功能请求提交至:https://firebase.google.com/support/contact/bugs-features/md5-8fad5406b734ff6789bcdb94f25799b4 我们得到了很多,我们很乐意为您提供帮助,但 GitHub 不是他们的最佳去处,他们将被关闭。 请先看一下指南:https://firebase.google.com/docs/cli/ 如果官方文档没有帮助,请尝试通过我们的官方支持渠道询问:https://firebase.google.com/支持/检查社区解决方案或帮助的其他位置:- Stack Overflow:https://stackoverflow.com/ - Firebase Slack 社区:https://firebase.community/ *请避免跨多个渠道重复发布!*

[必需] 环境信息

您使用的是哪个版本的 Firebase CLI (`firebase-tools`)? 请注意,您的问题可能已在最新版本中得到修复。 最新版本可以在 https://github.com/firebase/firebase-tools/releases 找到

firebase 工具: 8.2.0

平台: Linux debian 4.9.0-12-amd64

[必需] 重现步骤

~$ firebase init emulators -y

然后写下 firebase.json 中的firebase.json UI行,连接到 4000 端口。
这里有一个相关问题: https ://github.com/firebase/firebase-tools/issues/2332

"ui": {
      "enabled": true,      // Default is `true`
      "host": "localhost",
      "port": 4000          // If unspecified, see CLI log for selected port
    },

Firebase 官方文档: https ://firebase.google.com/docs/emulator-suite/install_and_configure#configure_emulator_suite

之后,启动模拟器。

~$ firebase emulators:start

[必需] 预期行为

预期的行为是什么?

预计将在 UI 模式下显示 Emulators Suite。

image

[必需] 实际行为

控制台上没有 Emulators Suite UI,只有集线器:

image

image

使用 --debug 标志的 Firebase-cli 日志

使用 --debug 标志运行命令,并包含以下日志。
$ ./node_modules/.bin/firebase emulators:start --debug
[2020-06-11T17:23:00.445Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2020-06-11T17:23:00.446Z] > authorizing via signed-in user
i  emulators: Starting emulators: functions, firestore, hosting
[2020-06-11T17:23:00.497Z] [hub] writing locator at /tmp/hub-medina-app-staging-67303.json
✔  hub: emulator hub started at http://localhost:4400
✔  functions: Using node<strong i="23">@10</strong> from host.
✔  functions: functions emulator started at http://localhost:5001
[2020-06-11T17:23:00.917Z] Ignoring unsupported arg: projectId
[2020-06-11T17:23:00.918Z] Ignoring unsupported arg: auto_download
[2020-06-11T17:23:00.918Z] Starting firestore emulator with command {"binary":"java","args":["-Duser.language=en","-jar","/home/paneladm/.cache/firebase/emulators/cloud-firestore-emulator-v1.11.3.jar","--host","localhost","--port",8080,"--rules","/home/paneladm/projects/paneladm-dev/medina-app/firestore.rules","--functions_emulator","localhost:5001"],"optionalArgs":["port","webchannel_port","host","rules","functions_emulator","seed_from_export"],"joinArgs":false}
i  firestore: firestore emulator logging to firestore-debug.log

i  firestore: firestore emulator logging to firestore-debug.log
[2020-06-11T17:23:02.124Z] API endpoint: http://localhost
[2020-06-11T17:23:02.125Z] :8080
If you are using a library that supports the FIRESTORE_EMULATOR_HOST environment variable, run:

   export FIRESTORE_EMULATOR_HOST=localhost:8080

Dev App Server is now running.


✔  firestore: firestore emulator started at http://localhost:8080
i  firestore: For testing set FIRESTORE_EMULATOR_HOST=localhost:8080
[2020-06-11T17:23:02.194Z] >>> HTTP REQUEST GET https://firebase.googleapis.com/v1beta1/projects/medina-app-staging-67303/webApps/-/config  

[2020-06-11T17:23:03.196Z] <<< HTTP RESPONSE 200 {"content-type":"application/json; charset=UTF-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","date":"Thu, 11 Jun 2020 17:23:02 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-27=\":443\"; ma=2592000,h3-25=\":443\"; ma=2592000,h3-T050=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q049=\":443\"; ma=2592000,h3-Q048=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
i  hosting[default]: Serving hosting files from: dist/public
✔  hosting[default]: Local server: http://localhost:5000
i  hosting[staging]: Serving hosting files from: dist/public
✔  hosting[staging]: Local server: http://localhost:5005
✔  hosting: hosting emulator started at http://localhost:5000
i  functions: Watching "/home/paneladm/projects/paneladm-dev/medina-app/dist/functions" for Cloud Functions...
[2020-06-11T17:23:03.278Z] [worker-pool] addWorker(~diagnostic~) 
[2020-06-11T17:23:03.279Z] [worker-pool] Adding worker with key ~diagnostic~, total=1 
[2020-06-11T17:23:03.279Z] [worker-pool] submitWork(triggerId=) 
[2020-06-11T17:23:03.280Z] [worker-~diagnostic~-097da58f-0d5d-4c2e-bbce-a4099abeb9db]: Assigning socketPath: /tmp/fire_emu_8048.sock 
[2020-06-11T17:23:03.280Z] [worker-~diagnostic~-097da58f-0d5d-4c2e-bbce-a4099abeb9db]: BUSY 
[2020-06-11T17:23:03.674Z] [runtime-status] [8048] Functions runtime initialized. {"cwd":"/home/paneladm/projects/paneladm-dev/medina-app/dist/functions","node_version":"10.20.1"} 
[2020-06-11T17:23:03.675Z] [runtime-status] [8048] Disabled runtime features: undefined 
[2020-06-11T17:23:03.678Z] [runtime-status] [8048] Resolved module firebase-admin {"declared":true,"installed":true,"version":"8.11.0","resolution":"/home/paneladm/projects/paneladm-dev/medina-app/dist/functions/node_modules/firebase-admin/lib/index.js"} 
[2020-06-11T17:23:03.679Z] [runtime-status] [8048] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.6.1","resolution":"/home/paneladm/projects/paneladm-dev/medina-app/dist/functions/node_modules/firebase-functions/lib/index.js"} 
[2020-06-11T17:23:03.683Z] [runtime-status] [8048] Outgoing network have been stubbed. [{"name":"http","status":"mocked"},{"name":"http","status":"mocked"},{"name":"https","status":"mocked"},{"name":"https","status":"mocked"},{"name":"net","status":"mocked"}] 
[2020-06-11T17:23:03.723Z] [runtime-status] [8048] Checked functions.config() {"config":{}} 
[2020-06-11T17:23:03.724Z] [runtime-status] [8048] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.6.1","resolution":"/home/paneladm/projects/paneladm-dev/medina-app/dist/functions/node_modules/firebase-functions/lib/index.js"} 
[2020-06-11T17:23:03.725Z] [runtime-status] [8048] Resolved module firebase-admin {"declared":true,"installed":true,"version":"8.11.0","resolution":"/home/paneladm/projects/paneladm-dev/medina-app/dist/functions/node_modules/firebase-admin/lib/index.js"} 
[2020-06-11T17:23:03.726Z] [runtime-status] [8048] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.6.1","resolution":"/home/paneladm/projects/paneladm-dev/medina-app/dist/functions/node_modules/firebase-functions/lib/index.js"} 
[2020-06-11T17:23:03.726Z] [runtime-status] [8048] firebase-admin has been stubbed. {"adminResolution":{"declared":true,"installed":true,"version":"8.11.0","resolution":"/home/paneladm/projects/paneladm-dev/medina-app/dist/functions/node_modules/firebase-admin/lib/index.js"}} 
[2020-06-11T17:23:03.820Z] [runtime-status] [8048] initializeApp(DEFAULT) {"databaseURL":"https://medina-app-staging-67303.firebaseio.com","storageBucket":"medina-app-staging-67303.appspot.com","projectId":"medina-app-staging-67303"} 
[2020-06-11T17:23:03.830Z] addFirestoreTrigger "{\"eventTrigger\":{\"resource\":\"projects/medina-app-staging-67303/databases/(default)/documents/messages/{documentId}\",\"eventType\":\"providers/cloud.firestore/eventTypes/document.create\",\"service\":\"firestore.googleapis.com\"}}"
[2020-06-11T17:23:03.831Z] >>> HTTP REQUEST PUT http://localhost:8080/emulator/v1/projects/medina-app-staging-67303/triggers/makeUppercase  
 {"eventTrigger":{"resource":"projects/medina-app-staging-67303/databases/(default)/documents/messages/{documentId}","eventType":"providers/cloud.firestore/eventTypes/document.create","service":"firestore.googleapis.com"}}
[2020-06-11T17:23:03.832Z] [worker-~diagnostic~-097da58f-0d5d-4c2e-bbce-a4099abeb9db]: IDLE 
[2020-06-11T17:23:03.882Z] Jun 11, 2020 2:23:03 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected non-HTTP/2 connection.

[2020-06-11T17:23:04.077Z] Jun 11, 2020 2:23:04 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected HTTP/2 connection.

[2020-06-11T17:23:04.918Z] <<< HTTP RESPONSE 200 {"content-type":"application/json","content-length":"4"}
[2020-06-11T17:23:04.919Z] addFirestoreTrigger "{\"eventTrigger\":{\"resource\":\"projects/medina-app-staging-67303/databases/(default)/documents/customers/{customerId}\",\"eventType\":\"providers/cloud.firestore/eventTypes/document.create\",\"service\":\"firestore.googleapis.com\"}}"
[2020-06-11T17:23:04.919Z] >>> HTTP REQUEST PUT http://localhost:8080/emulator/v1/projects/medina-app-staging-67303/triggers/onCustomerCreated  
 {"eventTrigger":{"resource":"projects/medina-app-staging-67303/databases/(default)/documents/customers/{customerId}","eventType":"providers/cloud.firestore/eventTypes/document.create","service":"firestore.googleapis.com"}}
[2020-06-11T17:23:04.931Z] Jun 11, 2020 2:23:04 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected non-HTTP/2 connection.

[2020-06-11T17:23:04.958Z] <<< HTTP RESPONSE 200 {"content-type":"application/json","content-length":"4"}
✔  functions[nextApp]: http function initialized (http://localhost:5001/medina-app-staging-67303/us-central1/nextApp).
✔  functions[addMessage]: http function initialized (http://localhost:5001/medina-app-staging-67303/us-central1/addMessage).
✔  functions[makeUppercase]: firestore function initialized.
✔  functions[onCustomerCreated]: firestore function initialized.
✔  functions[getSearchKey]: http function initialized (http://localhost:5001/medina-app-staging-67303/us-central1/getSearchKey).
✔  emulators: All emulators started, it is now safe to connect.

最有用的评论

@francisrod01是的,模拟器套件是在 8.4 中发布的!

所有3条评论

这个问题似乎没有遵循问题模板。 确保您提供所有必需的信息。

谷歌搜索了一会儿,我发现了文档中未描述的解决方案。 https://github.com/firebase/firebase-tools/issues/2272#issuecomment -636464586

如果我将firebase-tools更新到8.4.* $ 以上,它会起作用。

image

更新文档

有人可以更新文档中的模拟器部分吗?

@francisrod01是的,模拟器套件是在 8.4 中发布的!

此页面是否有帮助?
0 / 5 - 0 等级