firebase-tools: Fail to start emulator ui with "firebase emulators:start"

[REQUIRED] Environment info

firebase-tools:

$ firebase --version
11.0.0

Platform:

$ cat /etc/issue
Debian GNU/Linux 10 \n \l

[REQUIRED] Test case

$ firebase emulators:start
i  emulators: Starting emulators: auth, firestore, pubsub, storage
i  firestore: Firestore Emulator logging to firestore-debug.log
i  pubsub: Pub/Sub Emulator logging to pubsub-debug.log
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  firestore: Stopping Firestore Emulator
i  pubsub: Stopping Pub/Sub Emulator
i  auth: Stopping Authentication Emulator
i  storage: Stopping Storage Emulator
i  hub: Stopping emulator hub
i  logging: Stopping Logging Emulator

The settings are as follows:

$ cat firebase.json
{
  "firestore": {
    "rules": "config/firestore.rules",
    "indexes": "config/firestore.indexes.json"
  },
  "storage": {
    "rules": "config/storage.rules"
  },
  "emulators": {
    "ui": {
      "host": "0.0.0.0",
      "port": 4900
    },
    "auth": {
      "host": "0.0.0.0",
      "port": 4904
    },
    "storage": {
      "host": "0.0.0.0",
      "port": 4905
    },
    "firestore": {
      "host": "0.0.0.0",
      "port": 4906
    },
    "pubsub": {
      "host": "0.0.0.0",
      "port": 4907
    },
    "hub": {
      "host": "0.0.0.0",
      "port": 4998
    },
    "logging": {
      "host": "0.0.0.0",
      "port": 4999
    }
  }
}

[REQUIRED] Steps to reproduce

Same as above.

[REQUIRED] Expected behavior

I’m hoping the Emulator UI will boot…

[REQUIRED] Actual behavior

The following PRs may be the cause.

$ firebase --debug emulators:start

[snip]

[2022-05-19T14:02:24.780Z] Starting Emulator UI with command {"binary":"node","args":["--dns-result-order=ipv4first","/root/.cache/firebase/emulators/ui-v1.7.0/server.bundle.js"],"optionalArgs":[],"joinArgs":false} {"metadata":{"emulator":{"name":"ui"},"message":"Starting Emulator UI with command {\"binary\":\"node\",\"args\":[\"--dns-result-order=ipv4first\",\"/root/.cache/firebase/emulators/ui-v1.7.0/server.bundle.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"}}
[2022-05-19T14:02:24.955Z] node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module '/app/--dns-result-order=ipv4first'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function._resolveFilename (pkg/prelude/bootstrap.js:1955:46)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Function.runMain (pkg/prelude/bootstrap.js:1983:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
 {"metadata":{"emulator":{"name":"ui"},"message":"node:internal/modules/cjs/loader:936\n  throw err;\n  ^\n\nError: Cannot find module '/app/--dns-result-order=ipv4first'\n    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)\n    at Function._resolveFilename (pkg/prelude/bootstrap.js:1955:46)\n    at Function.Module._load (node:internal/modules/cjs/loader:778:27)\n    at Function.runMain (pkg/prelude/bootstrap.js:1983:12)\n    at node:internal/main/run_main_module:17:47 {\n  code: 'MODULE_NOT_FOUND',\n  requireStack: []\n}\n"}}

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 33
  • Comments: 15 (3 by maintainers)

Most upvoted comments

Hi all, thanks to all the information provided, we’ve located the issue in the standalone Firebase CLI binary. You can try the npm version (npm install -g firebase-tools and remove the standalone binary) as a workaround while we’re looking into a fix.

Fixed in v11.2.2.

Downgrading the Firebase CLI to 10.9.2 allows to workaround this.

@yuchenshi this workaround works. To remove the standalone version:

# Locate it with
which firebase 
# mine was at  /usr/local/bin/firebase
# rename or remove it
sudo mv /usr/local/bin/firebase /usr/local/bin/firebase11.01

I initially installed the Firebase CLI using the self install script on Linux. That installed version 11.0.0.

To downgrade

  1. Downloaded the Linux binary for 10.9.2 from here: https://github.com/firebase/firebase-tools/releases
  2. Use which firebase to find out where the current binary is installed (in my case /usr/local/bin/firebase)
  3. Rename the current file: sudo mv /usr/local/bin/firebase /usr/local/bin/firebase11
  4. Move the file you just downloaded: sudo mv /home/user/Downloads/firebase-tools-linux /usr/local/bin/firebase

If you installed if via npm or other means, you will likely have to do something different.

I’m using Node v18.2.0 with nvm and downgrade not working. I’m getting error like below

internal/modules/cjs/loader.js:59
const internalModuleStat = function (f) { return require('fs').internalModuleStat(f); };
                                                               ^

TypeError: require(...).internalModuleStat is not a function
    at internalModuleStat (internal/modules/cjs/loader.js:59:64)
    at stat (internal/modules/cjs/loader.js:143:18)
    at Function.Module._findPath (internal/modules/cjs/loader.js:645:16)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:951:27)
    at Function.Module._load (internal/modules/cjs/loader.js:840:27)
    at Module.require (internal/modules/cjs/loader.js:1024:19)
    at Module._preloadModules (internal/modules/cjs/loader.js:1276:12)
    at loadPreloadModules (internal/bootstrap/pre_execution.js:444:5)
    at prepareMainThreadExecution (internal/bootstrap/pre_execution.js:76:3)
    at internal/bootstrap/pkg.js:7:1
    ```
    
With version 11 of Firebase CLI I can't start emulators

node:internal/modules/cjs/loader:936 throw err; ^

Error: Cannot find module “/home/lukasz/projects/xxxxxxxxx/–dns-result-order=ipv4first” at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) at Function._resolveFilename (pkg/prelude/bootstrap.js:1955:46) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Function.runMain (pkg/prelude/bootstrap.js:1983:12) at node:internal/main/run_main_module:17:47 { code: “MODULE_NOT_FOUND”, requireStack: [] }

I know it’s not helpful but - really?