Firebase服务错误:端口5000未打开.无法启动功能模拟器 [英] Firebase serve error: Port 5000 is not open. Could not start functions emulator

查看:104
本文介绍了Firebase服务错误:端口5000未打开.无法启动功能模拟器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在本地提供Firebase功能,但是当我运行firebase servefirebase emulators:start时,错误消息是:端口5000未打开,无法启动功能仿真器."

I'm trying to serve firebase functions locally, but when I run firebase serve or firebase emulators:start the error message is: "Port 5000 is not open, could not start functions emulator."

我使用的是Windows 10,因此我尝试更改端口号,检查端口是否被防火墙阻止,并且在防火墙中为端口5000-5010创建了新规则,但这些方法均不适用于我

I'm using Windows 10, so I've tried to change the port number, check if the port is blocked by Firewall and I create a new rule in Firewall to ports 5000-5010 but none of this approaches worked for me.

推荐答案

最近在官方github存储库中报告了一个类似的问题:

A similiar problem has recently been reported in the official github repo: https://github.com/firebase/firebase-tools/issues/1606.

这是由依赖项(节点端口查找器)中的错误引起的,如您在此处看到的. https://github.com/http-party/node-portfinder/pull/86

It is caused by a bug in a dependency (node portfinder), as you can see here. https://github.com/http-party/node-portfinder/pull/86

一个快速的编辑方法可能是使用旧版本的节点端口查找器(v 1.0.21).另外,您可以通过编辑node_modules/firebase-tools/lib/emulator/controller.js并将yield pf.getPortPromise({ port, stopPort: port })更改为yield pf.getPortPromise({ port, stopPort: port + 1 })来实现.

A quick fix to edit it might be to use the old version of node portfinder (v 1.0.21). Alternatively, you can do it by editing node_modules/firebase-tools/lib/emulator/controller.js and changing yield pf.getPortPromise({ port, stopPort: port }) to yield pf.getPortPromise({ port, stopPort: port + 1 }).

如Mladen Skrbic所建议,要找到firebase-tools文件夹,应运行npm root -g并在其中找到firebase-tools文件夹.

As suggested by Mladen Skrbic, in order to find the firebase-tools folder, you should run npm root -g and find the firebase-tools folder in there.

这应该可以解决问题!

这篇关于Firebase服务错误:端口5000未打开.无法启动功能模拟器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆