Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
505 views
in Technique[技术] by (71.8m points)

How to shutdown Firebase Emulator properly on Windows 10

When the firebase emulator:start is ran in my vscode powershell terminal, some java.exe windows pop open. Everything works great.

When I go to close the firebase emulator, using the ctrl+c command, there are logs in the terminal suggesting that everything is supposedly shutting down gracefully. Here's the log after ^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:UsersscharDocumentsProgrammingProjectsCard Gamedatafirestore_export
i  Exporting data to: C:UsersscharDocumentsProgrammingProjectsCard Gamedata
i  emulators: Received export request. Exporting data to C:UsersscharDocumentsProgrammingProjectsCard Gamedata.
+  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

There's a (Y/N) prompt in there, so If I type Y or N, then the terminal comes back to regular powershell stand by.

In reality, the java.exe windows stays open. At that point, if I run firebase emulator:start again, I get an error saying that the emulator's ports are being used. If I close the java.exe windows manually and run the emulator again, it all works as expected.

I'm using Windows 10, powershell and VS code. I'm not looking for a hack to clear the ports as I can simply close the java.exe windows. I want to know how to close all of it in one fell swoop within powershell. Is there such a thing? Is this an issue I should be reporting?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I also had a similar issue. I had found two ways to solve this.

Method 1:

  1. Find the port and process ID using the following command

    netstat -a -o -n

  2. Use the below-mentioned command to kill that process

    taskkill /F /PID PROCESS_ID

where PROCESS_ID is the process id we got from step 1

  1. Start the emulator again

    firebase emulators:start

Method 2:

kill all of the Java process using the following command.

taskkill /f /im java.exe

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...