How install dependencies from `dune-project`?

How can I install specified dependencies in the dune-project file?

There is an opam file but it is empty, is dummy.opam

dune:

(dirs src reanalyze vendor)

dune-project

(lang dune 2.0)

(package
 (name test)
 (synopsis "test")
 (depends
  (ocaml
   (>= 4.10))
  (ocamlformat
   (= 0.22.4))
  (reanalyze
   (= 2.23.0))
  dune))

Is there something similar to npm install?

I created a switch using opam switch create ., but did not install ocamformat=0.22.4

It’s possible to generate an .opam file from dune-project: opam Integration — Dune documentation.

Although usually that would be already done by the project maintainer and committed into the repository (and kept in sync thereafter).

1 Like

Yes indeed, without (generate_opam_files true) specifying the dependencies yields no advantages at the moment since dune does not deal with OPAM packages for the most part.