You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
emulators not starting properly when emulating hosting on a vite project #5561
This issue does not have all the information required by the template. Looks like you forgot to fill out some sections. Please update the issue with more information.
Question: did you send the SIGINT yourself or did that come from somewhere else? It looks like the startup didn't complete, since we didn't see a table with host:ports for the various emulators
Question: did you send the SIGINT yourself or did that come from somewhere else? It looks like the startup didn't complete, since we didn't see a table with host:ports for the various emulators
Yes I did ctrl+c myself. Yes the table with host:ports doesn't shows up as shown in the screen shot below.
i Running script: vite
'vite' is not recognized as an internal or external command,
operable program or batch file.
! Script exited unsuccessfully (code 1)
i emulators: Shutting down emulators.
Since you're using hosting.source in your firebase.json, "vite" should be implied when spinning up the emulators. Can you try firebase emulators:start --project demo-myproject? We've had a couple fixes in the latest CLI too, might be worth updating.
Had the same issue. The promise from the below function does not get resolved because match does not return with the ip.. which is caused from the port having ansii bold characters.
The screen output from vite is pretty, but if you JSON.stringify(data.toString()), you get
" \u001b[32m➜\u001b[39m \u001b[1mLocal\u001b[22m: \u001b[36mhttp://127.0.0.1:\u001b[1m5173\u001b[22m/\u001b[39m\n\u001b[2m \u001b[32m➜\u001b[39m \u001b[1mNetwork\u001b[22m\u001b[2m: use \u001b[0m\u001b[1m--host\u001b[22m\u001b[2m\u001b[0m to expose\u001b[22m\n"
i Running script: vite
'vite' is not recognized as an internal or external command,
operable program or batch file.
! Script exited unsuccessfully (code 1)
i emulators: Shutting down emulators.
i Running script: vite
'vite' is not recognized as an internal or external command,
operable program or batch file.
! Script exited unsuccessfully (code 1)
i emulators: Shutting down emulators.
I tested this again and it seems like the error comes from enclosing vite in quotes. firebase emulators:exec --project demo-myproject vite --ui works at launching emulators suite with hosting. Though it still does not prints out the table showing the ports.
What I found the most compatible for vite and firebase for now is to change the hosting config to
I think the problem is in vite. When firebase hosting emulator runs the development script for vite it runs vite dev. Now, the problem is when we run vite dev, the console looks something like.
$ vite dev
VITE v4.4.7 ready in 3109 ms
➜ Local: http://localhost:5173/
➜ Network: http://172.24.80.1:5173/
➜ Network: http://192.168.43.173:5173/
➜ press h to show help
As you can see in the console, the command vite dev is waiting for an input, a key press if you will. And I think this is what that is not letting the firebase emulator start command to do it's thing further.
Activity
google-oss-bot commentedon Feb 27, 2023
This issue does not have all the information required by the template. Looks like you forgot to fill out some sections. Please update the issue with more information.
joehan commentedon Feb 28, 2023
Hey @tanjunior - Could you share the debug logs from this error (
firebase emluators:start --debug)?tanjunior commentedon Feb 28, 2023
Hey @joehan heres the log on a fresh project
firebase.json
{ "firestore": { "rules": "firestore.rules", "indexes": "firestore.indexes.json" }, "hosting": { "source": ".", "ignore": [ "firebase.json", "**/.*", "**/node_modules/**" ], "frameworksBackend": { "region": "asia-east1" } }, "emulators": { "firestore": { "port": 8080 }, "hosting": { "port": 5000 }, "ui": { "enabled": true }, "singleProjectMode": true } }firebase-debug.log
christhompsongoogle commentedon Mar 27, 2023
Question: did you send the SIGINT yourself or did that come from somewhere else? It looks like the startup didn't complete, since we didn't see a table with host:ports for the various emulators
laurentpayot commentedon Mar 28, 2023
@tanjunior In my Vite project I’m running my
vitecommand as an argument of thefirebase emulators:execcommand:Did you try this?
tanjunior commentedon Mar 28, 2023
Yes I did ctrl+c myself. Yes the table with host:ports doesn't shows up as shown in the screen shot below.
tanjunior commentedon Mar 28, 2023
I didn't know this argument existed. I will give it a try.
tanjunior commentedon Apr 3, 2023
jamesdaniels commentedon Apr 12, 2023
Since you're using hosting.source in your firebase.json, "vite" should be implied when spinning up the emulators. Can you try
firebase emulators:start --project demo-myproject? We've had a couple fixes in the latest CLI too, might be worth updating.baraya commentedon Apr 19, 2023
@jamesdaniels @tanjunior
Had the same issue. The promise from the below function does not get resolved because match does not return with the ip.. which is caused from the port having ansii bold characters.
The screen output from vite is pretty, but if you JSON.stringify(data.toString()), you get
firebase-tools/src/frameworks/vite/index.ts
Line 78 in b80de64
How I fixed it
baraya@5ca45eb
Now the function completes and the other emulators continue to start.
Kaev commentedon Apr 29, 2023
I'm encountering this problem aswell.
laurentpayot commentedon May 1, 2023
Does the
vitecommand at least work?tanjunior commentedon May 1, 2023
yes.
I tested this again and it seems like the error comes from enclosing vite in quotes.
firebase emulators:exec --project demo-myproject vite --uiworks at launching emulators suite with hosting. Though it still does not prints out the table showing the ports.What I found the most compatible for vite and firebase for now is to change the hosting config to
and simply run
firebase emulators:startThis config will also help when using
firebase deployrelated to another issue I found #5564akashlama1998-icloud commentedon Jul 25, 2023
I think the problem is in vite. When firebase hosting emulator runs the development script for vite it runs
vite dev. Now, the problem is when we runvite dev, the console looks something like.As you can see in the console, the command
vite devis waiting for an input, a key press if you will. And I think this is what that is not letting the firebase emulator start command to do it's thing further.Strip special characters from vite output (#6588)
Merging master into next. (#6619)
Merging master (#814)