firebase / firebase/firebase-tools
Firebase PubSub Emulator fails with spawn EINVAL on Node.js 18 — repeatedly downloads pubsub-emulator-0.7.1.jar and crashes
- Dominant language
- TypeScript
- Stars
- 4.5k
- Forks
- 1.3k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 84
Description
Title:
Firebase PubSub Emulator fails with spawn EINVAL on Node.js 18 — repeatedly downloads pubsub-emulator-0.7.1.jar and crashes
Body:
### Overview
When attempting to start the Firebase Emulator Suite (including PubSub) on Windows with Node.js 18, the pubsub emulator fails to launch due to repeated attempts to download pubsub-emulator-0.7.1.jar, followed by a crash with spawn EINVAL. This happens even when the .jar file is already downloaded locally, and even if a valid downloadPath is specified in firebase.json.
### Environment
- OS: Windows 10 / 11
- Node.js: 18.20.1 (installed via nvm-windows)
- Firebase CLI: 13.x (also tested with 12.9.1)
- Java: Temurin OpenJDK 11.0.26 (JAVA_HOME set)
- firebase.json:
{
"emulators": {
"pubsub": {
"port": 8085,
"downloadPath": ".cache/firebase/emulators"
}
}
}
### Problem Description
- When running `firebase emulators:start`, the CLI repeatedly tries to download `pubsub-emulator-0.7.1.jar`
- The emulator immediately crashes with: `spawn EINVAL`
- The .jar file (manually downloaded or previously cached) is ignored, and the CLI continues trying to re-download it
- All links to `pubsub-emulator-0.8.2.jar` are currently dead (404)
### Hypothesis
- As of early April 2025, it appears Google has removed older .jar files (like `0.8.2.jar`) from GCS
- `firebase-tools` (13.x) appears hardcoded to fetch that version or defaults back to `0.7.1.jar`, even though that version crashes under certain setups
- This behavior causes a loop of download + crash, making the emulator unusable
- The issue does not occur when using `firebase-tools@12.9.1` and manually placing the .jar
### Expected Behavior
- If a valid .jar is present at `downloadPath`, the emulator should use it without re-downloading or failing
- If the required .jar has been removed server-side, the CLI should fail gracefully or allow a version override
- `spawn EINVAL` should be caught with a clear error message
### Temporary Workaround (Verified Working Setup)
This configuration worked:
• Node.js: 18.20.1
• Firebase CLI: 12.9.1
• Java: Temurin OpenJDK 11.0.26
• The cloud-pubsub-emulator-0.7.1.jar was extracted from the official [Google Cloud SDK](https://cloud.google.com/sdk).
After installation, the jar was found under:
google-cloud-sdk/platform/pubsub-emulator/
• It was renamed to:
pubsub-emulator-0.7.1.jar
and placed manually in:
.cache/firebase/emulators/
• firebase.json:
{
"emulators": {
"pubsub": {
"port": 8085,
"downloadPath": ".cache/firebase/emulators"
}
}
}
Once this setup is applied, running `npx firebase emulators:start` correctly loads all pubsub-triggered functions, and no longer crashes.
### Notes
- The project also uses Gatsby, which currently does not support Node.js 20
- Upgrading Node is not a viable workaround
- This issue may affect any Windows developer using Firebase Emulator with PubSub
Please advise if this is an intentional removal or if support for 0.7.1 / 0.8.2 has been
Contributor guide
Assessment
This issue has not been assessed yet.