'reason-vscode' plugin errors on incompatible versions ocaml/preprocessor


In a ReasonML/BuckleScript project with bs-platform@7.0.1 (same with v6.2.1) in VSCode, ‘reason-vscode’ (v1.7.4) gives me the following error:

>> Fatal error: OCaml and preprocessor have incompatible versions
Fatal error: exception Whole_compiler.Misc.Fatal_error

The hover functionality does not work (i.e. showing the type). Syntax highlighting works though.

I have the following OCaml:

$ ocaml --version
The OCaml toplevel, version 4.06.1

I have the following switch (I also tried 4.02.3+buckle-master, without luck):

$ opam switch
#  switch                compiler                             description
   4.02.3+buckle-master  ocaml-variants.4.02.3+buckle-master  4.02.3+buckle-master
→  4.06.1                ocaml-base-compiler.4.06.1           4.06.1

And .merlin in my project is as follows:

B lib/bs
FLG -open Day13
FLG -ppx /Users/me/day13/node_modules/decco/ppx
FLG -ppx /Users/me/day13/node_modules/bs-platform/lib/bsppx.exe
S /Users/me/day13/node_modules/bs-platform/lib/ocaml
B /Users/me/day13/node_modules/bs-platform/lib/ocaml
FLG -nostdlib
FLG -w -30-40+6+7+27+32..39+44+45+101
S /Users/me/day13/node_modules/decco/lib/ocaml
B /Users/me/day13/node_modules/decco/lib/ocaml
S src
B lib/bs/src

The project compiles without errors, and the produced JavaScript is valid and runs fine.

Have any other run into the same problem? Or sees any obvious incompatible versions in my setup?

The OCaml and Reason IDE from Morrison works, so I could use that.


Did you install bs-platform?

npm install -g bs-platform

You shouldn’t need to even install opam to get this working. Just bs-platform, VSCode, and the reason-vscode plugin.


I had a similar incompatibility error when a library I was using needed a different version of Bucklescript. Downgrading to an earlier version worked for me.


Thanks for your suggestions!

@rashkov Yes, I have bs-platform installed:

$ bsc -v
BuckleScript 5.2.1 ( Using OCaml:4.02.3+BS )

I tried to upgrade this to latest (BuckleScript 7.0.1 ( Using OCaml:4.06.1+BS )), but the issue with reason-vscode still persists.

But I think you’re onto something, @kevanstannard. I’m using decco, the new version that is only compatible with bs-platform >= v6. When I downgraded my project dependencies to @ryb73/decco@0.1 and bs-plaftorm@^5 the reason-vscode plugin started to work again :slight_smile: So it seems that it is something with the new version of decco and the reason-vscode plugin that is incompatible.


I have BS 7, vscode plugin and decco working perfectly together but I know that sometimes if you have bs-platform installed globally and another local install, it can lead to some issues. Especially when the versions are different I guess. Try uninstalling the global version and just use the local one.


I tried to uninstall bs-platform, unfortunately that did not have any effect, the error (... incompatible versions) is still there. I also tried initializing a new project without decco with only bs-platform@^7 and reason-vscode@1.7.4, and it also has the same issue. Since it works for you, @tsnobip, I must have a broken setup somehow. In case others stumbles upon this, I’m using macOS Mojave (10.14.6) and VSCode 1.41.1.


I have the exact same setup, weird!