skip to Main Content

I followed the tutorial to set up Firebase Functions with Typescript at
https://firebase.google.com/docs/functions/typescript

However, when I run npm run serve or firebase emulators:start, emulators won’t start, but I’m getting the following error:

[2023-03-25T09:04:16.875Z] /Users/username/.cache/firebase/emulators/ui-v1.11.4/server/server.js:569
        re"use strict";
          ^^^^^^^^^^^^

I have tried deleting the cache folder, with no effect. In the file server.js, the relevant lines are:

function createDebug(namespace) {
    function debug2() {
      if (!debug2.enabled)
        re"use strict";

Installed versions of the relevant libraries are:

firebase --version
11.25.1

node -v
v16.19.1

npm -v
8.19.3

java --version
openjdk 19.0.2 2023-01-17
OpenJDK Runtime Environment Homebrew (build 19.0.2)
OpenJDK 64-Bit Server VM Homebrew (build 19.0.2, mixed mode, sharing)

tsc --version
Version 5.0.2

I’m out of ideas what to try, or what to reinstall. Any suggestions what I’m doing wrong?

I tried reinstalling all libraries, set up a new firebase project, installed the correct node version, reinstalled jdk. Was expecting emulators to run.

4

Answers


  1. I had the same issue

    [2023-03-25T09:04:16.875Z] /Users/username/.cache/firebase/emulators/ui- 
    v1.11.4/server/server.js:569
        re"use strict";
          ^^^^^^^^^^^^
    

    I fixed it with a flag:
    In firebase.json, set

    "ui": {
      "enabled": false      ← SET TO FALSE
    },
    

    It Works for me!
    Regards

    Login or Signup to reply.
  2. I had the same issue as you. I raised the following ticket on Firebase. Was facing this on MacOS (and Linux), but I assumed it’s an issue with the Node version I was using (not being LTS).

    Issue:

    After some investigation the following elements are the cause of the issue.

    • Node Version – using an incompatible version of Node. Change to Node LTS version.
    • Java Version – using an incompatible version of Java. Change to use compatible version e.g. Java version 11

    Resolution:

    To resolve it I amended the host environment to use compatible versions as described above. The Node + Java components are the ones that are important.

    On my device, the following setting allowed the Emulator UI to run successfully.

    node - v16.19.1
    npm - 8.19.3
    firebase - 11.25.1
    java openjdk - 11.0.18
    

    I then deleted the machine cache located:

    ~/.cache/firebase
    

    Then restart the emulator

    firebase emulators:start
    
    • The firebase emulator components should download again
    • The emulator starts up without the error.
    Login or Signup to reply.
  3. Here is the copy-paste solution from Richard Rose’s bug ticket:

    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
    
    Login or Signup to reply.
  4. None of the suggested solutions worked for me, I had to manually unzip ~/.cache/firebase/emulators/ui-v1.11.5.zip

    I found this solution on the github issue

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search