[WSL] How to launch browser debugging

Answered

Hi,

I've tried several times to somehow make browser debugging in WSL work, but already losing hope.

Of course the default browser settings and their executables, like i.e. "google-chrome" do not work. I do not have X server in WSL. In fact I tried even this option and it started, but I only saw window title bar and transparent content. So, it's definetely not stable enough.

So, I though the builtin "wslview" command can be used (provided by wslu package inside WSL). It doesn't want to start though, because there are some arguments passed to the command, and wslview only accepts URL without other arguments.

The next try was passing the windows path to the browser (the mounted path, like i.e. /mnt/c/program files/.../google-chrome.exe). I think this should normally be the best option, but Intellij passes a parameter with a custom user directory in /home/user/.cache, and it fails because Windows native browser cannot write to that WSL folder.

Is there any way to get it work?

If not, couldn't this custom user directory be made optional or configurable (so that it could be set to the some /mnt/c... folder)?

Overall, it's a pretty disappointing experience given how smoothly this integration work in VSCode's WSL.

I'm using an up-to-date 2022.3.1 version.

0
10 comments

So actually I finally found a config option in the Debug configuration to bypass that user directory.

However, if I pass in there any linux path, it says (well, reasonably) that the browser cannot write to that directory.

If I pass in there some valid windows path, the browser starts, but it stays on "about:blank" and the IDE debugger never connects to the browser. I guess it might have something to do with this user directory.

Hence, original question remains valid - is there any option to run "Javascript Debug" with the browser, using WSL?

0

Please could you elaborate on your setup? Do you have the IDE installed in WSL, or? Is the project stored in WSL?

I don't have issues debugging in browser when having the IDE installed on Windows and the project stored in WSL - the Chrome browser installed on Windows starts successfully and the debugger connects as expected. I'm using the default setup:

0

Hi, my setup seems to be just like yours.

The applications files are in the WSL filesystem.

The IDE is installed in Windows and I open the project via "Remote Development / WSL", so it installs another Intellij instance (or rather some kind of a gateway as far as I understand) in WSL.

When using windows executables of chrome or edge (i.e. /mnt/c/.../msedge.exe) it starts, after all, but neither chrome or edge connect to the debugger and the browser stays on "about:blank".

I appreciate your quick response, but I won't dig in any further. The whole WSL experience in Intellij is so painful (awfully slow startup, frequent disconnects with no successful reconnection, UI freezes where only killing the process helps, etc.) that I'll regretfully switch to an other IDE.

1

Ah, I see. You should have mentioned that you are using the remote development. JavaScript debugging is not yet supported there, please follow https://youtrack.jetbrains.com/issue/GTW-2069/Unable-to-debug-application-with-JS-debugger for updates

0

Hold on, please :)

So you can "just" open WSL-installed project via i.e. "Project from existing sources"? I didn't know :)

Is it fully supported? Actually if it fully works why is there this whole "Remote Development / WSL"?

Aren't there any issues with file watch events, reindexing, etc? What are the known problems of such a usage? And what would be the advantage of "Remote Development / WSL" (assuming it worked fine)?

0

>So you can "just" open WSL-installed project via i.e. "Project from existing sources"? I didn't know :)

Yes, it's fully supported. But there are still some issues like https://youtrack.jetbrains.com/issue/IDEA-293604/IntelliJ-is-slow-hanging-when-working-with-WSL-filesystem#focus=Comments-27-6747847.0-0

0

I just switched from vs code to webstorm for a fullstack project and i am facing the same issue.When i try to debug a simple html file that links a js file i get the message the error=2 about google chrome which means it does not exist. I tried the same thing as Rroszkowiak (/mnt/c/.../chrome.exe) but i still get the about:blank. Is there any solution to this or should i give up trying to set it up

0

Please see the thread above  it's not yet supported when using the remote development, but works out of the bo if the ide is installed on Windows and the project stored in WSL

0

Yes but isnt this very slow? I mean working with a project located in wsl and accessing it from the windows ide seems to cause performance issues

0
Well... There are known WSL problems with the cross-OS file system performance with WSL2 which affect us (specifically on loading the project and indexing). We hope it will be addressed by Microsoft; in the meantime, we added a possibility of running the indexer inside WSL (see https://youtrack.jetbrains.com/issue/IDEA-255733). So it should be OK (more or less). But there are still some issues like https://youtrack.jetbrains.com/issue/IDEA-293604/IntelliJ-is-slow-hanging-when-working-with-WSL-filesystem#focus=Comments-27-6747847.0-0
0

Please sign in to leave a comment.