如何在 Windows 10 上正确关闭 Firebase 模拟器

Sam*_*ier 8 firebase firebase-tools

当。。。的时候firebase emulator:start在我的 vscode powershell 终端中运行时,一些 java.exe 窗口会弹出。一切都很好。

当我使用 ctrl+c 命令关闭 firebase 模拟器时,终端中的日志表明一切都应该正常关闭。这是之后的日志^C

i  emulators: Received SIGINT (Ctrl-C) for the first time. Starting a clean shutdown.
i  emulators: Please wait for a clean shutdown or send the SIGINT (Ctrl-C) signal again to stop right now.
i  Automatically exporting data using --export-on-exit "./data" please wait for the export to finish...
Terminate batch job (Y/N)? i  Found running emulator hub for project une-petite-partie at http://localhost:4400
i  Deleting directory C:\Users\schar\Documents\Programming\Projects\Card Game\data\firestore_export
i  Exporting data to: C:\Users\schar\Documents\Programming\Projects\Card Game\data
i  emulators: Received export request. Exporting data to C:\Users\schar\Documents\Programming\Projects\Card Game\data.
+  emulators: Export complete.
+  Export complete
i  emulators: Shutting down emulators.
i  ui: Stopping Emulator UI
!  Emulator UI has exited upon receiving signal: SIGINT
i  functions: Stopping Functions Emulator
i  hosting: Stopping Hosting Emulator
i  database: Stopping Database Emulator
!  Database Emulator has exited upon receiving signal: SIGINT
i  firestore: Stopping Firestore Emulator
!  Firestore Emulator has exited upon receiving signal: SIGINT
i  pubsub: Stopping Pub/Sub Emulator
!  Pub/Sub Emulator has exited upon receiving signal: SIGINT
i  hub: Stopping emulator hub
i  logging: Stopping Logging Emulator
Run Code Online (Sandbox Code Playgroud)

那里有一个 (Y/N) 提示符,所以如果我输入 Y 或 N,那么终端将返回到常规 powershell 待机状态。

实际上,java.exe 窗口保持打开状态。此时,如果我firebase emulator:start再次运行,我会收到一条错误消息,指出模拟器的端口正在被使用。如果我手动关闭 java.exe 窗口并再次运行模拟器,一切都会按预期工作。

我正在使用 Windows 10、powershell 和 VS code。我并不是在寻找清除端口的方法,因为我可以简单地关闭 java.exe 窗口。我想知道如何在 powershell 中一下子关闭所有这些。有这样的事吗?这是我应该报告的问题吗?

Ank*_*van 8

我也有类似的问题。我找到了两种方法来解决这个问题。

方法一:

  1. 使用以下命令查找端口和进程 ID

    netstat -a -o -n

  2. 使用下面提到的命令来终止该进程

    taskkill /F /PID PROCESS_ID

其中 PROCESS_ID 是我们从步骤 1 获得的进程 ID

  1. 再次启动模拟器

    firebase emulators:start

方法二:

使用以下命令终止所有 Java 进程。

taskkill /f /im java.exe
Run Code Online (Sandbox Code Playgroud)