首页 > 解决方案 > 当我运行 firebase serve --only 托管时,功能托管不起作用

问题描述

我无法同时在本地模拟托管和功能。只有函数有效。

node -v
v10.15.3

firebase -V
6.9.0

当我跑步时,firebase serve --only hosting,functions我得到:

✔  functions: Using node@10 from host.
✔  functions: Emulator running at http://localhost:5001

只有函数开始模拟。并且网页不起作用。顺便说一下,默认端口是 5000。

当我跑步时,firebase serve我得到:

i  hosting: Serving hosting files from: public
✔  hosting: Local server: http://localhost:5000

和我运行时得到的一样:firebase serve --only hosting然后一个网页运行良好,但它无法访问为该网页提供 API 的函数。

我希望当我firebase serve --only hosting,functions同时运行托管和功能时,它们将开始在同一个端口上进行模拟。在我使用 4.x 版本的 firebase-tools 之前,它曾经可以工作

标签: firebasefirebase-cli

解决方案


firebase-tools 6.9.0 中有一个回归。降级作为临时修复。 npm i -g firebase-tools@6.8.0 https://github.com/firebase/firebase-tools/issues/1242


推荐阅读