Skip to content

Running MarkdownPreview throws uncaught exception: Error: spawn xdg-open ENOENT in WSL 2 with terminal Vim #199

Description

@nickjj

Hi,

I'm using Vim 8.1 inside of Ubuntu 20.04 running in WSL 2 using the latest pull from master at the time of writing this comment.

Inside of WSL 1 this plugin worked great. It would open my default browser when running that command without having to do anything custom.

But now within WSL 2 it fails to run :MarkdownPreview with:

[markdown-preview.vim] uncaught exception: Error: spawn xdg-open ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)

Turns out you need to install sudo apt-get install -y xdg-utils, and then things work fine. Although there is a ~5 second delay before it opens where as with WSL 1 it was instant.

Might be worth adding something to the docs or wiki for such an issue in a WSL section.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions