Firebase-tools: When running in WSL emulator does not properly detect lack of 'java' executable

Created on 10 Oct 2019  ·  7Comments  ·  Source: firebase/firebase-tools

Hi Firebase team,

I've not had success trying to get emulators working in WSL.

The recent update (https://github.com/firebase/firebase-tools/issues/1458) fixed the port was not active within 3000ms issue.

End goal is to have console.log() showing function output in the command prompt.

Here are the details:

[REQUIRED] Environment info


firebase-tools: 7.5.0


Platform: Windows/WSL

[REQUIRED] Test case

[REQUIRED] Steps to reproduce

Test commands pasted. The issue happens reliably everytime, emulators are unable to start.

[REQUIRED] Expected behavior


Emulators should start, firebase function output viewable in command prompt.

[REQUIRED] Actual behavior

firebase-debug.log
[debug] [2019-10-10T21:19:08.690Z] ----------------------------------------------------------------------
[debug] [2019-10-10T21:19:08.693Z] Command: /home/standard/.nvm/versions/node/v10.16.0/bin/node /home/standard/.nvm/versions/node/v10.16.0/bin/firebase emulators:start
[debug] [2019-10-10T21:19:08.693Z] CLI Version: 7.5.0
[debug] [2019-10-10T21:19:08.693Z] Platform: linux
[debug] [2019-10-10T21:19:08.693Z] Node Version: v10.16.0
[debug] [2019-10-10T21:19:09.522Z] Time: Fri Oct 11 2019 07:19:08 GMT+1000 (GMT+10:00)
[debug] [2019-10-10T21:19:09.522Z] ----------------------------------------------------------------------
[debug]
[debug] [2019-10-10T21:19:09.537Z] > 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] [2019-10-10T21:19:09.539Z] > authorizing via signed-in user
[info] i Starting emulators: ["functions","firestore","hosting"]
[warn] ⚠ Your requested "node" version "8" doesn't match your global version "10"
[info] ✔ functions: Emulator started at http://localhost:5001
[info] i firestore: Serving ALL traffic (including WebChannel) on http://localhost:8080
[warn] ⚠ firestore: Support for WebChannel on a separate port (8081) is DEPRECATED and will go away soon. Please use port above instead.
[debug] [2019-10-10T21:19:09.939Z] Ignoring unsupported arg: projectId
[debug] [2019-10-10T21:19:09.939Z] Ignoring unsupported arg: auto_download
[debug] [2019-10-10T21:19:09.939Z] Starting emulator firestore with command {"binary":"java","args":["-Duser.language=en","-jar","/home/DIR_NAME/standard/.cache/firebase/emulators/cloud-firestore-emulator-v1.9.0.jar","--host","localhost","--port",8080,"--rules","/mnt/c/Users/Standard/Documents/GitHub/DIR/firestore.rules","--functions_emulator","localhost:5001","--webchannel_port",8081],"optionalArgs":["port","webchannel_port","host","rules","functions_emulator"]}
[info] i firestore: Emulator logging to firestore-debug.log
[info] i Shutting down emulators.
[info] i Stopping functions emulator
[debug] [2019-10-10T21:19:09.999Z] Error: spawn java EACCES
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
[error]
[error] Error: An unexpected error has occurred.

Also, running firebase serve:
➜ DIR_NAMEgit:(master) ✗ firebase serve --only functions [11/10/19| 8:19AM]
⚠ Your requested "node" version "8" doesn't match your global version "10"
✔ functions: Emulator started at http://localhost:5000
i functions: Watching "/mnt/c/Users/Standard/Documents/GitHub/DIR_NAME/functions" for Cloud Functions...


git:(master) ✗ firebase emulators:start --debug [11/10/19| 8:30AM]
[2019-10-10T21:31:51.586Z] ----------------------------------------------------------------------
[2019-10-10T21:31:51.594Z] Command: /home/standard/.nvm/versions/node/v10.16.0/bin/node /home/standard/.nvm/versions/node/v10.16.0/bin/firebase emulators:start --debug
[2019-10-10T21:31:51.598Z] CLI Version: 7.5.0
[2019-10-10T21:31:51.599Z] Platform: linux
[2019-10-10T21:31:51.600Z] Node Version: v10.16.0
[2019-10-10T21:31:52.440Z] Time: Fri Oct 11 2019 07:31:51 GMT+1000 (GMT+10:00)
[2019-10-10T21:31:52.444Z] ----------------------------------------------------------------------

[2019-10-10T21:31:52.464Z] > 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"]
[2019-10-10T21:31:52.472Z] > authorizing via signed-in user
i Starting emulators: ["functions","firestore","hosting"]
⚠ Your requested "node" version "8" doesn't match your global version "10"
✔ functions: Emulator started at http://localhost:5001
i firestore: Serving ALL traffic (including WebChannel) on http://localhost:8080
⚠ firestore: Support for WebChannel on a separate port (8081) is DEPRECATED and will go away soon. Please use port above instead.
[2019-10-10T21:31:52.848Z] Ignoring unsupported arg: projectId
[2019-10-10T21:31:52.850Z] Ignoring unsupported arg: auto_download
[2019-10-10T21:31:52.851Z] Starting emulator firestore with command {"binary":"java","args":["-Duser.language=en","-jar","/home/standard/.cache/firebase/emulators/cloud-firestore-emulator-v1.9.0.jar","--host","localhost","--port",8080,"--rules","/mnt/c/Users/Standard/Documents/GitHub/DIR_NAME/firestore.rules","--functions_emulator","localhost:5001","--webchannel_port",8081],"optionalArgs":["port","webchannel_port","host","rules","functions_emulator"]}
i firestore: Emulator logging to firestore-debug.log
i Shutting down emulators.
i Stopping functions emulator
[2019-10-10T21:31:52.924Z] Error: spawn java EACCES
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)

Error: An unexpected error has occurred.

emulator-suite firestore bug

All 7 comments

This issue does not have all the information required by the template. Looks like you forgot to fill out some sections. Please update the issue with more information.

@barnu5 do you have java installed? Can you run java -version and tell me what version you have?

Thanks @samtstern for all your help.

I have now installed java separately, following this: https://wiki.jmk.hu/wiki/Install_Java_Development_Kit_on_Windows_Subsystem_for_Linux

I am now seeing hosting logging in the command prompt like: `127.0.0.1 - - [10/Oct/2019:22:14:40 +0000] "GET /static/media/image.f098d4b4.svg HTTP/1.1" 200 1783 "http://localhost:5000/app" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"

Can you tell me, how can I see firebase function logging output in the console?

@barnu5 if your function calls console.log() you should see that output in the console when the function runs. If you're not seeing that, please file a new issue for that.

I renamed this issue because we should be telling you when you don't have java but clearly we are not.

@samtstern In that case, you've just closed another one! I'll submit a new issue for the logging!

I want to leave this open so we can better detect this.

Was this page helpful?
0 / 5 - 0 ratings