Open rosera opened 1 year ago
I downgraded my node to LTS v16.19.1
and flushed the cache. That did the trick - I can now start the emulator on my device.
brew install node@16
flush the cache
rm -rf ~/.cache/firebase
Copy & Paste Solution:
brew install node@16
export PATH="/opt/homebrew/opt/node@16/bin:$PATH"
rm -rf ~/.cache/firebase
npm install -g firebase-tools
firebase emulators:start
We have some additional reports of this happening, though I'm not able to reproduce it. If anyone has additional details to share please comment on this issue.
For example some questions to help us narrow this down: does this happen with a fresh install? Is it only with Node 19?
Had another customer report that they encountered this on both node 18 and node 19 - unable to repro it myself though.
In my case I had a fresh install on a MacOS and Linux hosts (relevant tech stack in the original post).
I didnt need to reinstall the tooling e.g. npm i -g firebase-tools
. Downgrading the node version and removing the local cache did the trick for my situation.
Using the following Dockerfile I am able to replicate the original error message:
FROM debian:stable-slim
# Install updates
RUN apt-get update && apt-get -y upgrade
RUN apt-get install -y curl gcc g++ make default-jre
RUN curl -sL https://deb.nodesource.com/setup_19.x | bash -
RUN apt-get install -y nodejs
RUN npm install -g firebase-tools
RUN useradd -ms /bin/bash firebase-dev
USER firebase-dev
WORKDIR /home/firebase-dev
Build the image
docker build -t firebase-dev .
Run the container interactively with access to the host network
docker run -it --net=host firebase-dev /bin/bash
Then
At this point the following error message is shown:
firebase-dev@penguin:~$ firebase emulators:start
i emulators: Starting emulators: auth
i ui: downloading ui-v1.11.4.zip...
Progress: ========================================================================================================================================================================================================================> (100% of 4MB)
i ui: Emulator UI logging to ui-debug.log
âš ui: Fatal error occurred:
Emulator UI has exited with code: 1,
stopping all running emulators
i ui: Stopping Emulator UI
âš ui: Error stopping Emulator UI
i auth: Stopping Authentication Emulator
i hub: Stopping emulator hub
i logging: Stopping Logging Emulator
firebase-dev@penguin:~$ cat ui-debug.log
/home/firebase-dev/.cache/firebase/emulators/ui-v1.11.4/server/server.js:569
re"use strict";
^^^^^^^^^^^^
SyntaxError: Unexpected string
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1195:20)
at Module._compile (node:internal/modules/cjs/loader:1239:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
at Module.load (node:internal/modules/cjs/loader:1133:32)
at Module._load (node:internal/modules/cjs/loader:972:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
at node:internal/main/run_main_module:23:47
Node.js v19.8.1
having same issue on mac
/Users/mac/.cache/firebase/emulators/ui-v1.11.4/server/server.js:569
re"use strict";
^^^^^^^^^^^^
SyntaxError: Unexpected string
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1195:20)
at Module._compile (node:internal/modules/cjs/loader:1239:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
at Module.load (node:internal/modules/cjs/loader:1133:32)
at Module._load (node:internal/modules/cjs/loader:972:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
at node:internal/main/run_main_module:23:47
Node.js v19.8.1
Downgrading to Node 18 and clearing the cache as decribed above (copied here for signal boost) seems to resolve the issue. Node 19 is an experimental release. I'm still not clear why the cache clear is required though. There's a new release of the UI coming out this week that may resolve it.
nvm install --lts
rm -rf ~/.cache/firebase
npm install -g firebase-tools
firebase emulators:start
Faced this issue using Node 19, downgrading to 18 worked for me.
I get the exact same error on my Mac. Even after following the instructions by @christhompsongoogle. Node 19 or 18, and deleting cache, produces the same error.
@wyvx On my Mac environment I needed to ensure it matched both Node.js and Java requirements.
npm: 9.5.1
node: LTS Version
openjdk version "11.0.18" 2023-01-17
OpenJDK Runtime Environment Homebrew (build 11.0.18+0)
OpenJDK 64-Bit Server VM Homebrew (build 11.0.18+0, mixed mode)
I had an issue using the solutions above, due to multiple node versions installed with Homebrew.
I solved it with these steps:
@CTxD you can also go for version @18 and works fine
Only thing that worked for me was to go to ~/.cache/firebase/emulators/ui-v1.11.5
and manually unzip ui-v1.11.5.zip
there.
Copy & Paste Solution:
brew install node@16 export PATH="/opt/homebrew/opt/node@16/bin:$PATH" rm -rf ~/.cache/firebase npm install -g firebase-tools firebase emulators:start
Worked for me. Very annoying problem firebase team :(
Running NodeJS 18 and firebase-tools
11.27.0 here.
Tried manually clearing the cache, unfortunately that didn't help.
Unzipping the cache myself did work though, for some reason.
Looking at the difference between the 2 server.js
files, there's, what looks to me, like some transpilation/bundling that's happening differently.
@wyvx On my Mac environment I needed to ensure it matched both Node.js and Java requirements.
npm: 9.5.1 node: LTS Version openjdk version "11.0.18" 2023-01-17 OpenJDK Runtime Environment Homebrew (build 11.0.18+0) OpenJDK 64-Bit Server VM Homebrew (build 11.0.18+0, mixed mode)
From the initial issue, there are two issues at play.
Correcting the development environment to support the above, should resolve the issue. If you are still facing issues, you can independently test using the container manifest and adjust to the values as required:
FROM debian:stable-slim
# Install updates
RUN apt-get update && apt-get -y upgrade
RUN apt-get install -y curl gcc g++ make default-jre
RUN curl -sL https://deb.nodesource.com/setup_19.x | bash -
RUN apt-get install -y nodejs
RUN npm install -g firebase-tools
RUN useradd -ms /bin/bash firebase-dev
USER firebase-dev
WORKDIR /home/firebase-dev
In the above example, changing the nodesource from 19
to an LTS
version will result in a working environment.
I am running the emulators inside Docker on node:18-alpine
version and it's failing with the same error.
FROM node:18-alpine
RUN apk add openjdk11 curl
RUN npm install -g firebase-tools
RUN firebase setup:emulators:database
RUN firebase setup:emulators:ui
RUN mkdir -p /firebase
EXPOSE 4400
EXPOSE 4500
EXPOSE 5001
EXPOSE 5002
EXPOSE 5003
EXPOSE 5010
EXPOSE 5015
EXPOSE 5016
EXPOSE 5017
EXPOSE 9099
EXPOSE 9000
WORKDIR /firebase
ENTRYPOINT firebase --project=<PROJECT_ID> emulators:start --only database,auth,ui,hosting
Can you guys check the recent updates to the bundling logic of server.ts
?
Last commit I found related to this was: https://github.com/firebase/firebase-tools-ui/commit/dacf96e12d6fbe23cc921feba625f08a259d5a9c but it's quite a long time ago. I feel like I was able to run this container on Thursday (13/04/2023), now (17/04/2023) I can't 😞
Having the same issue in docker after the newest update. Docker Image: node:18-alpine Java Version: openjdk version "11.0.18" 2023-01-17 Node Version: 18.16.0 MacOS Version: 13.3.1
Already on node18 and openjdk11. Already tried flushing the cache.
Here's what the logs look like just before the error occurs:
✔ firestore: Firestore Emulator UI websocket is running on 9150. {"metadata":{"emulator":{"name":"firestore"},"message":"Firestore Emulator UI websocket is running on 9150."}}
i ui: downloading ui-v1.11.4.zip... {"metadata":{"emulator":{"name":"ui"},"message":"downloading ui-v1.11.4.zip..."}}
[2023-04-17T23:31:22.629Z] >>> [apiv2][query] GET https://storage.googleapis.com/firebase-preview-drop/emulator/ui-v1.11.4.zip
[2023-04-17T23:31:22.723Z] <<< [apiv2][status] GET https://storage.googleapis.com/firebase-preview-drop/emulator/ui-v1.11.4.zip 200
[2023-04-17T23:31:22.724Z] <<< [apiv2][body] GET https://storage.googleapis.com/firebase-preview-drop/emulator/ui-v1.11.4.zip [stream]
[2023-04-17T23:31:26.140Z] Ignoring unsupported arg: auto_download {"metadata":{"emulator":{"name":"ui"},"message":"Ignoring unsupported arg: auto_download"}}
[2023-04-17T23:31:26.141Z] Ignoring unsupported arg: port {"metadata":{"emulator":{"name":"ui"},"message":"Ignoring unsupported arg: port"}}
For those who is struggling with this issue, please read my comment here: https://github.com/firebase/firebase-tools/issues/5614#issuecomment-1508515106 to understand what's going on.
How to fix: Essentially you need to make sure you installing your emulators using node 18.15.0 or lower. If you have your emulators installed using higher version of node: remove it from cache folder (usually ~/.cache/firebase
).
Unfortunately it's not very easy to install a specific node version in your docker container. In the comment I shared my dockerfile to provide an idea of how to install it with nvm.
CC @DevDaveFrame @Durisvk
Hi @rosera, I believe Java version is not important, replying to:
From the initial issue, there are two issues at play.
- Not using Node.js LTS version.
- Not using the Java 11 version.
PS: One more comment about LTS version as a solution: No, it won't work and if this does work it's sheer luck, because what really happens is:
good
version of node (v18.15.x/v19.7.x or lower) .LTS
node from is still giving you v18.15.0 and not v18.16.0 which is the latest one as of today and running on which firebase-tools
struggle to unzip downloaded PubSub
& UI
emulators.CC @christhompsongoogle
v18.16.0 LTS https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V18.md#18.16.0
This is a new release (12th April I believe?) - if you have an issue with a specific version you can test using the dockerfile to verify the environment.
FROM debian:stable-slim
# Install updates
RUN apt-get update && apt-get -y upgrade
RUN apt-get install -y curl gcc g++ make default-jre
RUN curl -sL https://deb.nodesource.com/setup_19.x | bash -
RUN apt-get install -y nodejs
RUN npm install -g firebase-tools
RUN useradd -ms /bin/bash firebase-dev
USER firebase-dev
WORKDIR /home/firebase-dev
Got the same problem with node 18.16 (ui-emulator v1.11.5). Downgrading node to 18.15 and removing ~/.cache/firebase solved the issue.
i'm facing the same issue and even after confirming my node, npm, and openjdk versions are as listed by @rosera , I can't resolve the error. Tried clearing and removing my cache multiple times.
Looks like it finally worked after removing cache one last time, again!
If you're using VS Code devcontainers with feature ghcr.io/devcontainers/features/node, the good news is nvm is set up and works nicely. nvm install 18.15 && nvm use 18.15
worked around this issue for me.
I tried downgrading node version, Java version, etc. Not much seemed to work. Unzipped ui-v1.11.5.zip manually in ~/.cache/firebase
, and it's working now. My env is now OpenJDK 11 and Node 18.15.0 .
I tried downgrading node version, Java version, etc. Not much seemed to work. Unzipped ui-v1.11.5.zip manually in
~/.cache/firebase
, and it's working now. My env is now OpenJDK 11 and Node 18.15.0 .
I had my doubts, but this worked! Thanks @callumbirks :)
can confirm that pub/sub breaks the emulator on Latest LTS Version: 18.16.0
I am also running into this on my Mac using Docker. Here is the dockerfile for the fail scenario. Previously worked with older version of firebase-tools of 11.12.0.
FROM node:18-alpine
EXPOSE 4000
EXPOSE 5000
EXPOSE 5001
EXPOSE 8080
EXPOSE 8085
EXPOSE 9000
EXPOSE 9005
EXPOSE 9099
EXPOSE 9199
EXPOSE 9991
EXPOSE 9119
ENV HOME=/home/node
RUN apk --no-cache add openjdk11-jre bash && \
yarn global add firebase-tools@11.29.1 && \
yarn cache clean && \
firebase setup:emulators:database && \
firebase setup:emulators:firestore && \
firebase setup:emulators:pubsub && \
firebase setup:emulators:storage && \
firebase -V && \
java -version && \
chown -R node:node $HOME
ADD ./firebase-emulator.json /home/node/firebase.json
USER node
VOLUME $HOME/.cache
WORKDIR $HOME
CMD ["sh"]
Thank you all for the reports - this is caused by a break in our unzipper library dependency. We have a fix pending from Durisvk and are trying to get that in ASAP to resolve this issue.
Workaround:
The fix for this was released in v11.30.0, see here: https://github.com/firebase/firebase-tools/releases/tag/v11.30.0
Please upgrade past this to resolve the issue and let me know if you're still encountering any issues.
firebase v12.5.2. node v20.5.1
Same issue. Only way out for now is to disable ui with "ui": false in firebase.json. But then it's not easy to use the emulators. aargh.
@christhompsongoogle Is there a way I can get the previous release's server.js. If I could replace it, maybe it would work for now? Where can I find that file?
@sathishvj We're not able to reproduce the error on our end. Have you tried clearing the cache? We want the UI to be redownloaded and unzipped.
rm -rf ~/.cache/firebase
on Linux, whereas the Windows cache is C:\Users\username\.cache\firebase
IIRC
I did clear the cache multiple times, but that did not work by itself.
Was some other release made recently? Because it did start working thereafter with no changes from my side. I think I noticed some version change in the ui that was pulled down but I'm not 100% sure.
In any case, is there a way to configure the version of the emulator suite that is pulled down? The ability to configure that might help us in the future.
Still I can see the issue with combination firebase-tools v11.30.0
and NodeJS 18.17
(or 18.16
). I cleared firebase cache before every attempt (rm -rf ~/.cache/firebase/emulators
on Ubuntu 22.04).
Workaround: Downgrade NodeJS to 18.15
Same - issue occurs for me. Using firebase-tools v12.5.3.
Downgrading to Node v18.15 fixed it.
Same issue for me, firebase version 11.17.0 in combination with node 16 (latest), 18.15.0 and 18.18.0
Also worth mentioning that openjdk-17...
is probably a bad idea for anyone trying to use firebase-tools
13.0-.3... getting 11 installed and 17 purged, then cleaning the firebase cache and reinstalling firebase-tools
again seems to have fixed it. No mention of what error it was, no log entries or anything. Wish I could provide more info.
Using NVM on a mac.
Works for me with node 20.11.1 but only through the terminal and running firebase emulators:start
. I get the same problem when running npm run ...
, or using the Webstorm Run feature.
Using NVM on a mac.
Works for me with node 20.11.1 but only through the terminal and running
firebase emulators:start
. I get the same problem when runningnpm run ...
, or using the Webstorm Run feature.
Very interesting, I am running on x64 but running firebaes emulators:start
also works for me but not npm run emulators
for reference:
"emulators": "firebase emulators:start --import .emu --only firestore,auth",
running on a .devcontainer with these versions: node version: 18.19.1 javac version 21.0.2
Downgrading to Node 18 and clearing the cache as decribed above (copied here for signal boost) seems to resolve the issue. Node 19 is an experimental release. I'm still not clear why the cache clear is required though. There's a new release of the UI coming out this week that may resolve it.
nvm install --lts rm -rf ~/.cache/firebase npm install -g firebase-tools firebase emulators:start
This ALMOST worked for me. I had to run the following:
nvm install --lts
nvm use --lts
rm -rf ~/.cache/firebase
npm install -g firebase-tools
firebase emulators:start
Seems to be an issue with how node installations are handled.
considering a flutter project env, where normally I use flutter pub to update... I think it messed up the libs...
ProductName: macOS ProductVersion: 11.7.10 BuildVersion: 20G1427
Flutter 3.22.2 • channel stable Framework • revision 761747bfc5 (6 weeks ago) • 2024-06-05 22:15:13 +0200 Engine • revision edd8546116 DevTools 2.34.3
_Dart SDK version: 3.4.3 (stable) (Tue Jun 4 19:51:39 2024 +0000) on "macosx64"
tried before with node 18.5 and was raising same issue, so... I uninstall any node version, any rpm version. Then I install nvm, using macports, install node 16, install firebase-tools 11.14.2, clean the whole cache dir.
_nvm @0.39.70
nvm install 16
nvm use 16
nvm alias default 16
npm install -g firebase-tools@11.14.2
rm -rf ~/.cache/firebase
firebase emulators:start
Note: Before filing bugs in this repo, please ensure that this is a bug for the Emulator Suite UI. Emulator Suite and/or Firebase CLI bugs should be filed under the firebase-tools repo here: https://github.com/firebase/firebase-tools/issues/new/choose
Describe the bug A clear and concise description of what the bug is.
This issue on stackflow covers the error I am seeing when acccessing the Emulator UI https://stackoverflow.com/questions/75840698/i-cannot-run-firebase-emulators-on-fresh-install-getting-syntaxerror-unexpec
To Reproduce Steps to reproduce the behavior:
I am using a fresh install of Firebase tools on Mac.
firebase --version
MacOS
firebase emulators:start results in a UI error logged
Expected behavior Should be able to start the Firebase Emulator suite UI
Screenshots N/A
Desktop (please complete the following information):
Smartphone (please complete the following information):
N/A
Additional context New Flutter project added Authentication and Cloud Firestore emulator components. npm: 9.5.1 node: 19.8.1 openjdk version "11.0.18" 2023-01-17 OpenJDK Runtime Environment Homebrew (build 11.0.18+0) OpenJDK 64-Bit Server VM Homebrew (build 11.0.18+0, mixed mode)