Running MarkdownPreview throws uncaught exception: Error: spawn xdg-open ENOENT in WSL 2 with terminal Vim
See original GitHub issueHi,
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.
Issue Analytics
- State:
- Created 3 years ago
- Comments:17 (2 by maintainers)
Top Results From Across the Web
nivo tooltipFormat should allow fully custom formatting - TypeScript
... DOMPurify Running MarkdownPreview throws uncaught exception: Error: spawn xdg-open ENOENT in WSL 2 with terminal Vim - JavaScript markdown-preview.nvim.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
There is my solution: sudo ln -s /mnt/c/Program\ Files\ (x86)/Microsoft/Edge/Application/msedge.exe /usr/bin/edge let let g:mkdp_browser = ‘edge’
I just wanted to mention, using WSL2 (Arch if that makes a difference) the above methods did not work for me.
What DID work was to install wslu and set
g:mkdp_browser='wslview'
in my vimrc (well, init.vim). I have not experienced the multi-second delays the others are talking about using this approach.