微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

保存时占用的 Firebase 模拟器端口

如何解决保存时占用的 Firebase 模拟器端口

我正在尝试在本地运行 Firebase。我有作为模拟器运行的函数和 firestore。 当我保存对我的任何文件的更新时,它会再次运行 firebase,它应该如此。但是,它会尝试在之前运行的同一端口上再次运行模拟器,并且由于该端口仍处于活动状态,因此会引发错误 Could not start Firestore Emulator,port taken,表明该端口已被占用。我尝试使用以下方法为 Firestore 模拟器添加特定端口:

"emulators": {
  "firestore": {
    "port": "2525"
  }
}

但这并没有真正改变这样一个事实,即当我保存时它试图在端口 2525 上重新运行模拟器,但不能,因为它已经被占用了。

要从日志中添加更多详细信息:

i  emulators: Starting emulators: functions,firestore
⚠  emulators: It seems that you are running multiple instances of the emulator suite for project my-app. This may result in unexpected behavior.
⚠  functions: The following emulators are not running,calls to these services from the Functions emulator will affect production: auth,database,hosting,pubsub
✔  functions: Using node@12 from host.
i  emulators: Shutting down emulators.
i  functions: Stopping Functions Emulator
i  hub: Stopping emulator hub
⚠  firestore: Port 2525 is not open on localhost,Could not start Firestore Emulator.
⚠  firestore: To select a different host/port,specify that host/port in a firebase.json config file:
      {
        // ...
        "emulators": {
          "firestore": {
            "host": "HOST","port": "PORT"
          }
        }
      }
i  emulators: Shutting down emulators.

Error: Could not start Firestore Emulator,port taken.

Having trouble? Try firebase [command] --help
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! functions@ serve: `npm run build && firebase emulators:start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the functions@ serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/mememe/.npm/_logs/2021-01-11T21_21_03_874Z-debug.log
[nodemon] app crashed - waiting for file changes before starting...

我该怎么办?

更新

目前,我可以继续工作的唯一方法是触发此脚本命令 npm run build && npx kill-port 2525 && firebase emulators:start,以便它在重新加载时终止 firestore 模拟器端口。显然这是愚蠢的,所以我期待 Firebase 团队或知道如何处理这个问题的人的来信。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?