Firebase服务于vagrant localhost:5000

时间:2018-02-18 17:11:42

标签: firebase vagrant

我在mac os high sierra上运行vagrant / ubuntu 16.04。我已将端口转发和符号链接设置为awesome.local.com。基本的node.js网络应用程序运行良好,可以在mac chrome浏览器上查看指向awesome.local.com:3000

我想以相同的方式在这个环境中开发firebase,并且能够设置CLI并登录。

浏览Firebase Web Codelab:https://codelabs.developers.google.com/codelabs/firebase-web/index.html?index=..%2F..%2Findex#0

运行时

$ firebase serve

看起来一切都在运行而没有错误(我做了调试):

hosting: Local server: http://localhost:5000

当我访问浏览器并指向awesome.local.com:5000时,我得到:

This site can’t be reached

awesome.locl.com refused to connect.
Search Google for awesome.local.com:5000
ERR_CONNECTION_REFUSED

我试过了:

  • 重建开发环境
  • 重新安装所有内容
  • 其他教程

感谢您提供任何帮助。

1 个答案:

答案 0 :(得分:1)

如果要针对其他主机和端口运行firebase serve,请参阅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以外的任何其他内容都无法访问。

相关问题