cargo: `cargo doc --open` doesn't work in WSL
I’m using ubuntu(WSL) in windows, and I found this problem.
At the beginning, without any configuration, I got some error message. Following the error message, I set BROSWER environmental variable, and the error was gone and browser is opened. However nothing appear, seems it open browser but forget pass the “*.html”.
I’m sure it the BROWSER is set correctly, because follow command /usr/bin/sensible-browser xxx/inndex.html works well in shell.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 13
- Comments: 20 (6 by maintainers)
A short-term solution is to run
explorer.exe .or point it to your project path, navigate to/target/doc/{package_name}, and then double-clickindex.html.This can be solved with below
and add
export BROWSER='xxx/open_browser.sh'to ~/.bashrcIf you use Brave Browser with Ubuntu 20.04:
~/.scripts/open_browser.shchmod +x ~/.scripts/open_browser.shexport BROWSER='~/.scripts/open_browser.sh'to~/.bashrcNow,
cargo doc --openshould work as expected.It works after update Cargo 1.55 without BROWSER env!