I have just installed ocaml, opam and dune on my computer and tried to run a new project using
$ dune init project calculator
$ cd calculator/
$ code .
which creates the project and opens it in VS Code. But when I try build and run the project with
dune exec bin/main.exe
or with dune build
in the terminal, I get this error message:
File "dune-project", line 1, characters 11-15:
1 | (lang dune 3.14)
^^^^
Error: Version 3.14 of dune is not supported.
Supported versions:
- 1.0 to 1.12
- 2.0 to 2.9
Is there a way to downgrade dune to 2.9?
Thanks in advance!
Now I tried to update opam to the newest version with:
opam update && opam upgrade
, but I get the message that I have already installed the newest version 2.1.2-1.
My dune version is: 2.9.1 My opam version is: 2.1.2
This sounds like an inconsistent environment: you created your project with dune 3.14
, and you are trying to build it with dune 2.9.1
which is a much older version. The best solution is probably to use dune 3.14
for building your project too, but yes you can simply change your project configuration to require only dune 2.9 by editing
(lang dune 3.14)
to
(lang dune 2.9)