【问题标题】:Firebase serve from vagrant localhost:5000Firebase 来自 vagrant localhost:5000
【发布时间】:2018-07-28 23:48:15
【问题描述】:

我在 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

我试过了:

  • 重建开发环境
  • 重新安装一切
  • 其他教程

感谢您对此的任何帮助。

【问题讨论】:

    标签: firebase vagrant


    【解决方案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 之外的任何东西都无法访问。

    【讨论】:

    • 你是对的!这是我在进行端口转发时的设置。我已将其设置为 192.168.68.8。这样做: $ firebase serve -p 5000 -o 192.168.68.8 成功了。谢谢!
    • @jkpham001 如果这个回答对你有帮助,请采纳为正确。
    猜你喜欢
    • 2022-11-29
    • 1970-01-01
    • 1970-01-01
    • 2022-06-11
    • 2017-03-14
    • 2021-12-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多