firebase / firebase/firebase-tools-ui

firebase emulators:start Fails with ESM Import Error in Emulator UI on MacOS

Open
#1,059 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
291
Forks
74
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug

Running `firebase emulators:start --debug` causes a fatal error in the Emulator UI, exiting with code `1`. This error appears to be related to the module type for `server.mjs`, which requires ESM support but is being handled by CommonJS’s `require()`.

### To Reproduce

1. Run `firebase init` and select only **auth** to emulate.
2. Enable the Emulator **UI** during setup.
3. Execute `firebase emulators:start`.

My firebase.json
```
{
"emulators": {
"auth": {
"port": 9099
},
"ui": {
"enabled": true
},
"singleProjectMode": true
}
}
```

### Expected behavior

The emulators should start successfully, with the Emulator UI accessible and logging as expected.

### Screenshots

_No screenshots were provided._

### Desktop (please complete the following information):

- **OS**: MacOS 15.0.1 (24A348)
- **Browser**: (e.g., Chrome, Safari)
- **Version**: _(e.g., Chrome 22)_

### Additional context

- **Node version**: v20.14.0
- The error suggests using `import()` in place of `require()` for `/server/server.mjs`, aligning with Node's ESM requirements.
- Emulator UI version: v1.14.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.