Skip to content

Improve emulator env-related error-handling (e.g. missing java) #3443

@yuri-sergiichuk

Description

@yuri-sergiichuk

[REQUIRED] Environment info

firebase-tools: 9.12.1

Platform: Ubuntu 20.04 (via WSL2)

[REQUIRED] Test case

Run firebase-tools without java being installed.

[REQUIRED] Steps to reproduce

Install firebase-tools, run firebase init and then smth like firebase emulators:start --only storage.

[REQUIRED] Expected behavior

firebase-tools complains about missing java.

[REQUIRED] Actual behavior

Smth like this is dumped into the debug log:

[debug] [2021-06-03T11:20:32.039Z] ----------------------------------------------------------------------
[debug] [2021-06-03T11:20:32.041Z] Command:       /home/<user>/.nvm/versions/node/v14.17.0/bin/node /home/<user>/.nvm/versions/node/v14.17.0/bin/firebase emulators:start
[debug] [2021-06-03T11:20:32.041Z] CLI Version:   9.12.1
[debug] [2021-06-03T11:20:32.041Z] Platform:      linux
[debug] [2021-06-03T11:20:32.041Z] Node Version:  v14.17.0
[debug] [2021-06-03T11:20:32.041Z] Time:          Thu Jun 03 2021 14:20:32 GMT+0300 (Eastern European Summer Time)
[debug] [2021-06-03T11:20:32.041Z] ----------------------------------------------------------------------
[debug]
[debug] [2021-06-03T11:20:32.045Z] > 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"]
[debug] [2021-06-03T11:20:32.046Z] > authorizing via signed-in user (<user>)
[info] i  emulators: Starting emulators: storage {"metadata":{"emulator":{"name":"hub"},"message":"Starting emulators: storage"}}
[warn] ⚠  emulators: It seems that you are running multiple instances of the emulator suite for project <project>. This may result in unexpected behavior.
[debug] [2021-06-03T11:20:32.059Z] [hub] writing locator at /tmp/hub-<project>.json
[debug] [2021-06-03T11:20:32.083Z] Ignoring unsupported arg: port {"metadata":{"emulator":{"name":"storage"},"message":"Ignoring unsupported arg: port"}}
[debug] [2021-06-03T11:20:32.151Z] Error: spawn java ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)
[error]
[error] Error: An unexpected error has occurred.

** Additional info

As soon as I install java the very same command works without a glitch.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions