Firebase Emulator fails at startup Cannot find module --dns-result-order=ipv4first

Viewed 1411

The firebase emulator 11.0.0 is failing to start

firebase emulators:start

an Exception is thrown when it gets to Emulator UI...

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

The stack trace from ui-debug.log shows...

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

Error: Cannot find module '/Users/hayden/Desktop/parent_app_firebase_cloud_emulator/functions/--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: [] }.

Looks like the error has something to do with line 84...

Starting Emulator UI with command {"binary":"node","args":["--dns-result-order=ipv4first"

Which then throw an error in node as its unable to find a module called --dns-result-order=ipv4first

Any ideas on how to startup the local firebase emulator so it runs without failing with this exception?

Running Node 16 and Firebase 11.0.0

3 Answers

Downgrading to 10.9.2 fixes the issue for me:

npm i -g firebase-tools@10.9.2

This bug still exists but thanks to the github link provided by @Viktor the firebase team have located the issue and provided a temporary work-around...

Issue source: standalone Firebase CLI binary

Solution: remove the standalone binary & re-install with npm...

Step 1. locate firebase standalone binary..

which firebase

prints something like... /usr/local/bin/firebase

Step 2. rename or delete this folder...

sudo mv /usr/local/bin/firebase /usr/local/bin/firebase_broken

Step 3. reinstall using npm

 npm install -g firebase-tools

Step 4. Good to go! re-run from project folder...

firebase emulators:start

Yes downgrading works. On Mac I had to execute following:

sudo npm i -g firebase-tools@10.9.2 --force
Related