Cargo doc --open defaults to firefox, then fails

I am pretty new to rust and am following the rust programming language book and got to the cargo doc part. The problem is that cargo doc seems to want to use firefox to open the docs, but this fails like this:

warning: Couldn't open docs with firefox: No such file or directory (os error 2)

I have installed firefox-developer-edition on my system and html files are set to use firefox-developer-edition to open.

Is there anything I can do to auto-open the documentation with the command?

This seems likely to be a desktop misconfiguration. What do these two commands do or print?

echo $BROWSER
xdg-open target/doc/<insert your package name here>/index.html

(I'm assuming you're using Linux.)

echo $BROWSER => firefox
xdg-open .... => firefox-developer-edition

It seems that you have an environment variable BROWSER=firefox, but don't have a program named firefox installed. Find where you have BROWSER=firefox (perhaps somewhere in your shell init files) and change it to BROWSER=firefox-developer-edition. Then restart your shell, and cargo doc --open should start working as you want.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.