ocamlmerlin issue in Visual Studio Code

657 views Asked by At

I've been using VSC on my MacBook Pro, but recently when I open .ml files in VSC I have started getting a message in the lower right-hand corner of the window that says "Cannot find merlin binary at 'ocamlmerlin'." Additionally, in Output I get the following:

Error: spawn ocamlmerlin ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
    at onErrorNT (internal/child_process.js:465:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn ocamlmerlin',
  path: 'ocamlmerlin',
  spawnargs: []
}
[Error - 4:35:35 PM] Connection to server got closed. Server will not be restarted.

I've also noticed that the red squiggly lines that identify coding errors have stopped appearing. Has anyone else seen this type of error before with VSC?

1

There are 1 answers

0
BigHero101 On
  1. Depending on your platform, the user settings file for vs code is located here:

Windows %APPDATA%\Code\User\settings.json.

macOS /Users/<YOUR-HOME-DIRECTORY>/Library/Application Support/Code/User/settings.json.

Linux $HOME/.config/Code/User/settings.json.

  1. Open the file settings.json and paste the following inside:
{
    "ocaml.merlinPath": "/Users/nick/.opam/system/bin/ocamlmerlin",
    "reason.path.ocamlmerlin": "/Users/<YOUR-HOME-DIRECTORY>/.opam/system/bin/ocamlmerlin"
}