-
Notifications
You must be signed in to change notification settings - Fork 379
Description
Today I was trying to create a switch, and it failed with to me confusing error messages:
$ opam switch create . --deps-only -t
<><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><>
Switch invariant: ["ocaml" {>= "4.05.0"}]
[ERROR] Could not determine which packages to install for this switch:
* Missing dependency:
- (invariant) -> ocaml
unknown package
Switch initialisation failed: clean up? ('n' will leave the switch partially installed) [y/n] y
$ opam switch create . 4.14.2 --deps-only -t
[ERROR] No compiler matching `4.14.2' found, use `opam switch list-available' to see what is
available, or use `--packages' to select packages explicitly.
$ opam switch list-available
# Listing available compilers from repositories:
# No matches foundIn the end it turned out that I had removed the default repository and added my own repository (using opam-mirror). I had used --all but not --set-default when adding the local repository. This then results in new switches to defaulting to no repositories and it makes sense it can't find ocaml when there are no package repositories. Only the last command really gave a hint of the cause, but it is somewhat ambiguous because it's not clear that it's an empty list and not just "here are the compilers I found:" colon.
I think it is very rare that it is desirable to create a switch without repositories - at least when the switch variant isn't [] - so I think it could improve the user experience to tell me that I probably made a mistake.
Thank you!