question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When running in WSL emulator does not properly detect lack of 'java' executable

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
samtsterncommented, Oct 10, 2019

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

1reaction
samtsterncommented, Oct 10, 2019

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Windows Subsystem for Linux not recognizing JAVA_HOME ...
Open PowerShell. Then set JAVA_HOME to the path to your java installation. · In your case, run setx JAVA_HOME "D:\Program Files\Java\jdk-11.0.1".
Read more >
Experiencing WSL as a Linux Veteran - Berk Ulsoy
WSL 1 relies on LXSS Manager Service for the emulation of Linux system calls, therefore there is no virtualization.
Read more >
Command 'java' not found on WSL, even though ... - Ask Ubuntu
I tried java.exe and javac.exe in the bash terminal and it does work properly! Is it "bad" to do this (i.e. should I...
Read more >
Download Android Studio & App Tools - Android Developers
The Android Emulator allows you to test your application on a variety of Android devices. Unlock the full potential of your apps by...
Read more >
picocli - a mighty tiny command line interface
Any command line argument that is not an option or subcommand is interpreted as a positional parameter. Java. Kotlin. String[] args = {...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found