firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

Emulator UI is broken on FirePit

Open rvahlin opened this issue 1 year ago • 31 comments

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.

rvahlin avatar Mar 28 '24 08:03 rvahlin

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

google-oss-bot avatar Mar 28 '24 08:03 google-oss-bot

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 avatar Mar 28 '24 10:03 aalej

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.

yannickfh avatar Mar 28 '24 12:03 yannickfh

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.

AndrejZelonka avatar Mar 29 '24 09:03 AndrejZelonka

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.

david7227 avatar Mar 30 '24 17:03 david7227

Hey folks, thanks for the additional information. I tried to reproduce this issue again, and as mentioned in https://github.com/firebase/firebase-tools/issues/6931#issuecomment-2026961704, 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 avatar Apr 01 '24 10:04 aalej

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.

pedro-patriota avatar Apr 01 '24 12:04 pedro-patriota

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 avatar Apr 01 '24 17:04 joehan

Duplicates https://github.com/firebase/firebase-tools-ui/issues/1014

joehan avatar Apr 01 '24 18:04 joehan

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

slack2450 avatar Apr 02 '24 08:04 slack2450

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

AbhijithBn avatar Apr 24 '24 12:04 AbhijithBn

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

Stf-F avatar Apr 30 '24 15:04 Stf-F

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

Thanks this was the issue

creotiv avatar May 05 '24 12:05 creotiv

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

This fixed the problem for me. Thanks!

tbrownio avatar May 18 '24 18:05 tbrownio

Please, can you fix this? It's definitely a bug. The bundle should work.

george-oakling avatar May 24 '24 11:05 george-oakling

Can confirm the error only happens on curl installed firebase tools

undesicimo avatar Jun 02 '24 15:06 undesicimo

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

Even though it works right now after following these exact steps @Stf-F listed, after initialising the project again with firebase init it shows the following warning that might cause problems in the near future

(node:96126) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead. (Use node --trace-deprecation ... to show where the warning was created)

s-scheck avatar Jun 12 '24 22:06 s-scheck

Hey @s-scheck - the warning you're seeing there is coming from a deprecation done in Node 22, and is nothing to worry about for now. We haven't started targeting Node 22 yet (mostly because we're busy trying to move all our dependencies to get rid of deprecation warnings like that!), but will in the next major version we release.

joehan avatar Jun 13 '24 22:06 joehan

I was also hit by this issue using it in Docker. I confirm using npm i firebase-tools -g fixed it for me too

dtellz avatar Jul 03 '24 17:07 dtellz

Hey @s-scheck - the warning you're seeing there is coming from a deprecation done in Node 22, and is nothing to worry about for now. We haven't started targeting Node 22 yet (mostly because we're busy trying to move all our dependencies to get rid of deprecation warnings like that!), but will in the next major version we release.

Great! Looking forward to v14.

msrumon avatar Jul 07 '24 07:07 msrumon

Node v18.5.0 still getting the ERR_REQUIRE_ESM error upon trying to run firebase emulators:start I also tried removing tools from the package file and installing it globally. No success.

nickjuntilla avatar Jul 10 '24 02:07 nickjuntilla

I have faced the same issue when using firebase codelabs. I have followed these steps

  • Deleted my firebase command line as mentioned in https://github.com/firebase/firebase-tools/issues/6931#issuecomment-2094793543
  • Deleted cache file at $HOME/.cache/firebase
  • Installed Firebase cli as a global package again using npm (I have given access to npm as given in https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally).

prasannakumar414 avatar Jul 11 '24 18:07 prasannakumar414

Removing firebase tools and doing this:

sudo rm -rf /usr/local/bin/firebase and re-installing with brew install firebase-cli

Ended up working for me however I'm not sure if this is going to jive with running multiple versions of node on the same machine. I guess we'll see.

nickjuntilla avatar Jul 11 '24 19:07 nickjuntilla

Can confirm the error only happens on curl installed firebase tools

This is still happening for me when installing with firebase tools using curl -sL firebase.tools | bash on macOS Sonoma 14.5, on an M1 Max

Removing firebase tools and doing this:

sudo rm -rf /usr/local/bin/firebase and re-installing with brew install firebase-cli

Ended up working for me however I'm not sure if this is going to jive with running multiple versions of node on the same machine. I guess we'll see.

This is also what worked for me

mikaelacaron avatar Jul 30 '24 15:07 mikaelacaron

Still broke. after npm i -g firebase.tools Mac 14.6.1 (23G93) M1 Max After this command, it can run

sudo rm -rf /usr/local/bin/firebase and re-installing with brew install firebase-cli

But still have this deprecation warning too to this date.

(node:96126) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead. (Use node --trace-deprecation ... to show where the warning was created)

yuanzd123 avatar Aug 28 '24 23:08 yuanzd123

Still broke. after npm i -g firebase.tools Mac 14.6.1 (23G93) M1 Max After this command, it can run

sudo rm -rf /usr/local/bin/firebase and re-installing with brew install firebase-cli

But still have this deprecation warning too to this date.

(node:96126) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead. (Use node --trace-deprecation ... to show where the warning was created)

After I delete ~/.cache and .npm-global folder, and run

sudo rm -rf /usr/local/bin/firebase
npm i -g firebase-tools

Everything works without any warning or bugs, even got rid of the DeprecationWarning

yuanzd123 avatar Aug 29 '24 01:08 yuanzd123

We still have this problem with automatic install script. What's the version of firebase-tools that does not have this exact problem?

erayerdin avatar Sep 02 '24 13:09 erayerdin

We still have this problem with automatic install script. What's the version of firebase-tools that does not have this exact problem?

13.16.0

yuanzd123 avatar Sep 02 '24 17:09 yuanzd123

We still have this problem with automatic install script. What's the version of firebase-tools that does not have this exact problem?

I've been using 13.5.0 for 2 months now. Not sure if any future updates has fixed this issue. Just run curl -Lo /usr/local/bin/firebase https://firebase.tools/bin/linux/v13.5.0 and you should be good to go.

msrumon avatar Sep 09 '24 11:09 msrumon

sudo rm -rf /usr/local/bin/firebase npm i -g firebase-tools

worked for me as suggested by @yuanzd123 on 13.17.0 tools.

MonkeyDrone avatar Sep 19 '24 00:09 MonkeyDrone