rescript-compiler icon indicating copy to clipboard operation
rescript-compiler copied to clipboard

Update opam install command to correct flag

Open jderochervlk opened this issue 10 months ago • 4 comments

I noticed while following the setup steps that one of the flags was no longer correct.

$ opam install . --deps-only --with-test --with-dev-setup -y

opam: unknown option `--with-dev-setup', did you mean `-w' ?
Usage: opam install [OPTION]... [PACKAGES]...
Try `opam install --help' or `opam --help' for more information.

From what I can tell that flag is no longer needed: https://github.com/ocaml/dune/issues/10538

jderochervlk avatar Mar 13 '25 13:03 jderochervlk

Is it possible you're using opam version 2.1.x or below?

--with-dev-setup was introduced in opam v2.2.0, released July 2024: https://opam.ocaml.org/blog/opam-2-2-0/#Major-change-with-dev-setup

When I initially followed the setup steps, I ran into the same issue as you, but it turned out to be from using the version of opam from the Ubuntu 24.04 repos - currently v2.1.5

When I installed opam with bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh)" to get v2.3.0, I no longer had this issue:

~ opam --version
2.3.0
                                                                                                                                     
~ opam install --help | grep with-dev
       --with-dev-setup
       OPAMWITHDEVSETUP see install option `--with-dev-setup'.

mediremi avatar Mar 13 '25 20:03 mediremi

Ah right, it even says so in #6901 where this flag was introduced.

I guess this PR can be closed then?

cknitt avatar Mar 14 '25 07:03 cknitt

--with-dev-setup was introduced in opam v2.2.0

And the contributing guide already says opam 2.2.0 is needed. Should probably say ">= 2.2.0" - @jderochervlk would you like to update this PR to make that clearer in the contributing guide?

cknitt avatar Mar 23 '25 09:03 cknitt

If you're using the devcontainer, it's a problem with the container which is installing opam via APT.

The latest version of OPAM in the Bookworm's registry is 2.1.2

cometkim avatar Mar 23 '25 11:03 cometkim