Firebase 从 vagrant localhost:5000 提供服务 [英] Firebase serve from vagrant localhost:5000
问题描述
我在 mac os high sierra 上运行 vagrant/ubuntu 16.04.我已将端口转发和符号链接设置为 awesome.local.com.基本的 node.js Web 应用程序完美运行,可以在指向 awesome.local.com:3000 的 mac chrome 浏览器上查看
I'm running vagrant/ubuntu 16.04 on mac os high sierra. I have set port forwarding and symlink to awesome.local.com. Basic node.js web app works perfectly and can be viewed on mac chrome browser pointing to awesome.local.com:3000
我想以同样的方式在此环境中开发 firebase,并且能够设置 CLI 并正常登录.
I want to develop firebase in this environment the same way, and was able to set-up the CLI and logged in fine.
浏览 Firebase 网络代码实验室:https://codelabs.developers.google.com/codelabs/firebase-web/index.html?index=..%2F..%2Findex#0
Going through the Firebase Web Codelab: https://codelabs.developers.google.com/codelabs/firebase-web/index.html?index=..%2F..%2Findex#0
运行时
$ firebase serve
看起来一切正常运行(我调试过):
Looks like everything is running without error (I did debug):
hosting: Local server: http://localhost:5000
当我转到浏览器并指向 awesome.local.com:5000 时,我得到:
When I go to the browser and point to awesome.local.com:5000 I get:
This site can’t be reached
awesome.locl.com refused to connect.
Search Google for awesome.local.com:5000
ERR_CONNECTION_REFUSED
我试过了:
- 重建开发环境
- 重新安装一切
- 其他教程
感谢您对此的任何帮助.
Thanks for any help with this.
推荐答案
如果您想针对不同的主机和端口运行 firebase serve
,请参阅 CLI 中的帮助:
If you want to run firebase serve
against a different host and port, see the help in the CLI:
$ firebase serve --help
Usage: serve [options]
start a local server for your static assets
Options:
-p, --port <port> the port on which to listen (default: 5000) (default: 5000)
-o, --host <host> the host on which to listen (default: localhost) (default: localhost)
--only <targets> only serve specified targets (valid targets are: functions, hosting)
--except <targets> serve all except specified targets (valid targets are: functions, hosting)
-h, --help output usage information
您可以使用 -p
和 -o
更改它侦听的主机和端口.默认只会绑定到 localhost,除了 127.0.0.1 之外的任何东西都无法访问.
You can change the host and port it listens to with -p
and -o
. The default will only bind to localhost, which will not be accessible to anything other than 127.0.0.1.
这篇关于Firebase 从 vagrant localhost:5000 提供服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!