firebase / firebase-tools-ui

A local-first UI for Firebase Emulator Suite.
https://firebase.googleblog.com/2020/05/local-firebase-emulator-ui.html
Apache License 2.0
262 stars 60 forks source link

Can't start Emulator UI with node 18.16.0 [/firebase/emulators/ui-v1.11.5/server/server.js:569 re"use strict";] #942

Closed imabot2 closed 1 year ago

imabot2 commented 1 year ago

Maybe the same problem as this issue

Describe the bug I can't start the emulator

To Reproduce Run on Ubuntu 22.04 LTS 5.19.0-40-generic #41~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 31 16:00:14 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Node is installed with Volta node -v => v18.16.0 npm -v => 9.5.1 firebase tools --version => 11.28.0

I think everything is installed properly, I can deploy and runfirebase emulators:start --only functions

When I run the emulator:

$ firebase emulators:start --debug
[2023-04-23T19:44:38.124Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2023-04-23T19:44:38.125Z] > authorizing via signed-in user (xxx@gmail.com)
i  emulators: Starting emulators: functions {"metadata":{"emulator":{"name":"hub"},"message":"Starting emulators: functions"}}
[2023-04-23T19:44:38.130Z] [logging] Logging Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[2023-04-23T19:44:38.131Z] assigned listening specs for emulators {"user":{"hub":[{"address":"127.0.0.1","family":"IPv4","port":4400},{"address":"::1","family":"IPv6","port":4400}],"ui":[{"address":"127.0.0.1","family":"IPv4","port":4000},{"address":"::1","family":"IPv6","port":4000}],"logging":[{"address":"127.0.0.1","family":"IPv4","port":4500}]},"metadata":{"message":"assigned listening specs for emulators"}}
[2023-04-23T19:44:38.142Z] [hub] writing locator at /tmp/hub-fir-87878.json
[2023-04-23T19:44:38.154Z] [functions] Functions Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[2023-04-23T19:44:38.154Z] [eventarc] Eventarc Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[2023-04-23T19:44:38.155Z] late-assigned ports for functions and eventarc emulators {"user":{"hub":[{"address":"127.0.0.1","family":"IPv4","port":4400},{"address":"::1","family":"IPv6","port":4400}],"ui":[{"address":"127.0.0.1","family":"IPv4","port":4000},{"address":"::1","family":"IPv6","port":4000}],"logging":[{"address":"127.0.0.1","family":"IPv4","port":4500}],"functions":[{"address":"127.0.0.1","family":"IPv4","port":5001}],"eventarc":[{"address":"127.0.0.1","family":"IPv4","port":9299}]},"metadata":{"message":"late-assigned ports for functions and eventarc emulators"}}
⚠  functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: auth, firestore, database, hosting, pubsub, storage {"metadata":{"emulator":{"name":"functions"},"message":"The following emulators are not running, calls to these services from the Functions emulator will affect production: \u001b[1mauth, firestore, database, hosting, pubsub, storage\u001b[22m"}}
[2023-04-23T19:44:38.159Z] defaultcredentials: writing to file /home/xxx/.config/firebase/xxx_gmail.com_application_default_credentials.json
[2023-04-23T19:44:38.170Z] Setting GAC to /home/xxx/.config/firebase/xxx_gmail.com_application_default_credentials.json {"metadata":{"emulator":{"name":"functions"},"message":"Setting GAC to /home/xxx/.config/firebase/xxx_gmail.com_application_default_credentials.json"}}
[2023-04-23T19:44:38.172Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/fir-87878/adminSdkConfig [none]
[2023-04-23T19:44:38.382Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/fir-87878/adminSdkConfig 200
[2023-04-23T19:44:38.383Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/fir-87878/adminSdkConfig {"projectId":"fir-87878","storageBucket":"fir-87878.appspot.com"}
[2023-04-23T19:44:38.405Z] Ignoring unsupported arg: auto_download {"metadata":{"emulator":{"name":"ui"},"message":"Ignoring unsupported arg: auto_download"}}
[2023-04-23T19:44:38.405Z] Ignoring unsupported arg: port {"metadata":{"emulator":{"name":"ui"},"message":"Ignoring unsupported arg: port"}}
[2023-04-23T19:44:38.405Z] Starting Emulator UI with command {"binary":"node","args":["/home/xxx/.cache/firebase/emulators/ui-v1.11.5/server/server.js"],"optionalArgs":[],"joinArgs":false} {"metadata":{"emulator":{"name":"ui"},"message":"Starting Emulator UI with command {\"binary\":\"node\",\"args\":[\"/home/xxx/.cache/firebase/emulators/ui-v1.11.5/server/server.js\"],\"optionalArgs\":[],\"joinArgs\":false}"}}
i  ui: Emulator UI logging to ui-debug.log {"metadata":{"emulator":{"name":"ui"},"message":"Emulator UI logging to \u001b[1mui-debug.log\u001b[22m"}}
[2023-04-23T19:44:38.485Z] /home/xxx/.cache/firebase/emulators/ui-v1.11.5/server/server.js:569
        re"use strict";
          ^^^^^^^^^^^^

SyntaxError: Unexpected string
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1176:20)
    at Module._compile (node:internal/modules/cjs/loader:1218:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47

Node.js v18.16.0
 {"metadata":{"emulator":{"name":"ui"},"message":"/home/xxx/.cache/firebase/emulators/ui-v1.11.5/server/server.js:569\n        re\"use strict\";\n          ^^^^^^^^^^^^\n\nSyntaxError: Unexpected string\n    at internalCompileFunction (node:internal/vm:73:18)\n    at wrapSafe (node:internal/modules/cjs/loader:1176:20)\n    at Module._compile (node:internal/modules/cjs/loader:1218:27)\n    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)\n    at Module.load (node:internal/modules/cjs/loader:1117:32)\n    at Module._load (node:internal/modules/cjs/loader:958:12)\n    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)\n    at node:internal/main/run_main_module:23:47\n\nNode.js v18.16.0\n"}}
⚠  ui: Fatal error occurred: 
   Emulator UI has exited with code: 1, 
   stopping all running emulators {"metadata":{"emulator":{"name":"ui"},"message":"Fatal error occurred: \n   Emulator UI has exited with code: 1, \n   stopping all running emulators"}}
i  ui: Stopping Emulator UI {"metadata":{"emulator":{"name":"ui"},"message":"Stopping Emulator UI"}}
[2023-04-23T19:44:42.493Z] Emulator UI: Unable to terminate process (PID=7922) {"metadata":{"emulator":{"name":"ui"},"message":"Emulator UI: Unable to terminate process (PID=7922)"}}
⚠  ui: Error stopping Emulator UI {"metadata":{"emulator":{"name":"ui"},"message":"Error stopping Emulator UI"}}
i  functions: Stopping Functions Emulator {"metadata":{"emulator":{"name":"functions"},"message":"Stopping Functions Emulator"}}
i  eventarc: Stopping Eventarc Emulator {"metadata":{"emulator":{"name":"eventarc"},"message":"Stopping Eventarc Emulator"}}
i  hub: Stopping emulator hub {"metadata":{"emulator":{"name":"hub"},"message":"Stopping emulator hub"}}
i  logging: Stopping Logging Emulator {"metadata":{"emulator":{"name":"logging"},"message":"Stopping Logging Emulator"}}

Having trouble? Try firebase [command] --help

It try to clear the cache with rm -rf ~/.cache/firebase. That did not solve the problem.

I suspect a bug with node@18.16.0 because it works when I downgrade to node@16.20.0

Durisvk commented 1 year ago

Duplicate of: https://github.com/firebase/firebase-tools/issues/5677 https://github.com/firebase/firebase-tools-ui/issues/939 https://github.com/firebase/firebase-tools-ui/issues/940

(related also to: https://github.com/firebase/firebase-tools/issues/5614)

Being fixed here: https://github.com/firebase/firebase-tools/pull/5714 and here: https://github.com/firebase/firebase-tools/pull/5724 (depending on which one gets merged and released)

imabot2 commented 1 year ago

Thanks. When released, how do I update to the last version? npm update -g firebase-tools ?

Durisvk commented 1 year ago

Thanks. When released, how do I update to the last version? npm update -g firebase-tools ?

@imabot2 yes, or you can just do npm update -g firebase-tools.

In the meantime you can disable the ui in your firebase.json:

"ui": {
  "enabled": false
}

or removing the ~/.cache/firebase/emulators/ui-v1.6.4 and manually unzipping ~/.cache/firebase/emulators/ui-v1.6.4.zip

endrureza commented 1 year ago

Downgrading the node to v18.15, remove .cache/firebase and re-run once more. This should work, at least that's what i was doing.

cupidchan commented 1 year ago

Duplicate of: firebase/firebase-tools#5677 #939 #940

(related also to: firebase/firebase-tools#5614)

Being fixed here: firebase/firebase-tools#5714 and here: firebase/firebase-tools#5724 (depending on which one gets merged and released)

@Durisvk do you know when will be the fix become official release?

christhompsongoogle commented 1 year ago

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.