Firebaseエミュレータが起動しない
以前、Zennのスクラップ機能にメモを残しながらFlutter/Firebaseアプリを作成していましたが約1年が経過。
長らくFlutter/Firebaseから離れてしまっていましたが再開。 そしてFirebaseエミュレータを起動しようとしたら↓のようなエラーが。
⚠ hosting: Port 5000 is not open on localhost, could not start Hosting Emulator. {"metadata":{"emulator":{"name":"hosting"},"message":"Port 5000 is not open on localhost, could not start Hosting Em ulator."}} ⚠ hosting: To select a different host/port, specify that host/port in a firebase.json config file: { // ... "emulators": { "hosting": { "host": "HOST", "port": "PORT" } } } {"metadata":{"emulator":{"name":"hosting"},"message":"To select a different host/port, specify that host/port in a firebase.json config file:\n {\n // ...\n \"emulators\": {\n \"hosting\": {\n \"host\": \"\u001b[33mHOST\u001b[39m\",\n \"port\": \"\u001b[33mPORT\u001b[39m\"\n }\n }\n }"}} i emulators: Shutting down emulators. {"metadata":{"emulator":{"name":"hub"},"message":"Shutting down emulators."}} Error: Could not start Hosting Emulator, port taken.
Firebase Hostingで使用する5000番ポートが開かないと。 どうやらmacOS MontereyからAirPlayが5000番を使うようになったらしく、ポートの衝突が起きているらしい。 firebase.jsonを開き、"hosting"のポート番号を変更すると起動出来るようになりました。
"hosting": { - "port": 5000 + "port": 5002 },