Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to start Firebase emulators #6931

Open
rvahlin opened this issue Mar 28, 2024 · 13 comments
Open

Unable to start Firebase emulators #6931

rvahlin opened this issue Mar 28, 2024 · 13 comments

Comments

@rvahlin
Copy link

rvahlin commented Mar 28, 2024

firebase-tools:
13.5.2

Platform:
macOS
Sonoma 14.3.1

[REQUIRED] Test case

I followed the instructions in the Install, configure and integrate Local Emulator Suite guide. When I start up the emulators by running firebase emulators:start, all emulators except for Emulator Suite UI will start but the UI emulators throws an error:

Fatal error occurred: Emulator UI has exited with code: 1, stopping all running emulators

When I review my ui-debug.log, I can see the below message:

`node:internal/modules/cjs/loader:986
throw new ERR_REQUIRE_ESM(filename, true);
^

Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/XXXXX/.cache/firebase/emulators/ui-v1.11.8/server/server.mjs not supported.
Instead change the require of /Users/XXXXX/.cache/firebase/emulators/ui-v1.11.8/server/server.mjs to a dynamic import() which is available in all CommonJS modules.
at Function.runMain (pkg/prelude/bootstrap.js:1979:12) {
code: 'ERR_REQUIRE_ESM'
}

Node.js v18.5.0`

Don't know why the log states "Node.js v18.5.0", as I'm running v21.7.1 and I don't know if this is relevant or not.

[REQUIRED] Steps to reproduce

Follow the steps in the Install, configure and integrate Local Emulator Suite guide.

[REQUIRED] Expected behavior

Should be able to start the UI Emulator

[REQUIRED] Actual behavior

Unable to start the UI Emulator. Logs are included in the "Test case" section above.

@google-oss-bot
Copy link
Contributor

This issue does not seem to follow the issue template. Make sure you provide all the required information.

@aalej
Copy link
Contributor

aalej commented Mar 28, 2024

Hey @rvahlin, thanks for reaching out. Sorry to hear you encountered this issue. I’m trying to reproduce this locally, but so far I haven’t encountered any issue with starting the emulators.

I’d like to recommend switching to an even version of Node.js(20.x.x) since those versions have long term support. After that, could you try deleting the contents of /Users/XXXXX/.cache/firebase/emulators, then run firebase emulators:start, which should re-install the emulator ui. Are there any changes in behavior after doing so?

Also, could you run node -v just to verify the Node.js version you’re running.

I used the following to try and reproduce this:

  • firebase-tools: v13.6.0
  • node: v20.10.0, v21.7.1, and v18.5.0
  • platform: macOS Sonoma 14.4

@aalej aalej added the Needs: Author Feedback Issues awaiting author feedback label Mar 28, 2024
@yannickfh
Copy link

i've experienced te same issue on:
firebase-tools: v13.6.0
node: v18.19.1
platform: macOS Sonoma 14.2.1

Switching my node version (back) to v18.19.0 i was able to start the emulator again.

@AndrejZelonka
Copy link

AndrejZelonka commented Mar 29, 2024

I've experienced the same issue (on a project where setup was already done)

Installing firebase-tools as a global npm package instead of automatic install script via curl helped.

@david7227
Copy link

I've experienced the same issue (on a project where setup was already done)

Installing firebase-tools as a global npm package instead of automatic install script via curl helped.

It worked for me, the problem seems to stem from the CLI installation.
Thanks alot.

@aalej
Copy link
Contributor

aalej commented Apr 1, 2024

Hey folks, thanks for the additional information. I tried to reproduce this issue again, and as mentioned in #6931 (comment), it seems like this issue occurs when firebase-tools is installed via the automatic install script. I’ll raise this issue to our engineering team.

@aalej aalej added reproducible and removed Needs: Author Feedback Issues awaiting author feedback labels Apr 1, 2024
@pedro-patriota
Copy link

pedro-patriota commented Apr 1, 2024

I faced this same issue and, since I only needed the firebase emulators to be initialized, a partial solution I found was to remove the UI option in firebase init command or manually set UI enabled option to false.

@joehan
Copy link
Contributor

joehan commented Apr 1, 2024

Hey all, thanks for reporting this - a quick explanation of what's going on.

When installed via firebase.tools, the CLI comes bundled with node (so that you can run it without node installed on your machine beforehand). It looks like a recent release of the emulator UI added a require() of a ES module, which is incompatible with the bundled Node config.

Apologies for the inconvenience here - I'll take a crack a fixing this today. In the interim, installing firebase-tools through npm i firebase-tools -g or disabling the Emulator UI should avoid this issue.

@joehan
Copy link
Contributor

joehan commented Apr 1, 2024

Duplicates firebase/firebase-tools-ui#1014

@slack2450
Copy link

Make sure you remove firebase tools first through sudo rm -rf /usr/local/bin/firebase

@AbhijithBn
Copy link

AbhijithBn commented Apr 24, 2024

This is just a suggestion for mac users. You can install firebase-cli using brew. That fixed this issue for me.

brew install firebase-cli

@Stf-F
Copy link

Stf-F commented Apr 30, 2024

This is just a suggestion for mac users. You can install firebase-cli using brew. That fixed this issue for me.

Same here.
First tried to delete the cache located under/Users/XXXXX/.cache/firebase/emulators as per @aalej answer here, but no luck.
Ended up deleting firebase as mentioned by @slack2450 with sudo rm -rf /usr/local/bin/firebase and re-installing with brew install firebase-cli

@creotiv
Copy link

creotiv commented May 5, 2024

sudo rm -rf /usr/local/bin/firebase

Thanks this was the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests