reasonml / reason-cli

Globally installable Reason toolchain.
MIT License
291 stars 23 forks source link

Cannot start ocamlmerlin - `ocaml/ocamlmerlin is not installed correctly` #31

Open jordwest opened 7 years ago

jordwest commented 7 years ago

cc @andreypopp re the chat on Discord

./node_modules/.bin/bsb -w works fine, however running ocaml or ocamlmerlin both fail:

➜ ocaml -version
/Users/jordan/.nvm/versions/node/v6.10.3/bin/ocaml: line 121: cd: /Users/jordan/.esy/store-3.x.x/_install/ocaml-4.02.3-90ad951bb234c3b1e1b5a03e3a5a261a84da222c/bin/../actualInstall: No such file or directory
/Users/jordan/.nvm/versions/node/v6.10.3/bin/ocaml: line 122: /Users/jordan/.esy/store-3.x.x/_install/ocaml-4.02.3-90ad951bb234c3b1e1b5a03e3a5a261a84da222c/bin/../node_modules/.bin/esy: No such file or directory

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

ocaml is not installed correctly. Either the initial installation
failed or the global build cache was purged, which cleared out the global
installation. Reinstall by doing:

  npm uninstall -g reason-cli
  npm install -g https://github.com/reasonml/reason-cli

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

➜ ocamlmerlin -version
/Users/jordan/.nvm/versions/node/v6.10.3/bin/ocamlmerlin: line 121: cd: /Users/jordan/.esy/store-3.x.x/_install/opam_alpha__slash__merlin-2.5.4-e82ed956b19d8e4a97c150a18ad33daa93f4734c/bin/../actualInstall: No such file or directory
/Users/jordan/.nvm/versions/node/v6.10.3/bin/ocamlmerlin: line 122: /Users/jordan/.esy/store-3.x.x/_install/opam_alpha__slash__merlin-2.5.4-e82ed956b19d8e4a97c150a18ad33daa93f4734c/bin/../node_modules/.bin/esy: No such file or directory

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

ocamlmerlin is not installed correctly. Either the initial installation
failed or the global build cache was purged, which cleared out the global
installation. Reinstall by doing:

  npm uninstall -g reason-cli
  npm install -g https://github.com/reasonml/reason-cli

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

rtop also returns a strange error:

/Users/jordan/.esy/store-3.x.x/_install/opam_alpha__slash__utop-1.19.3-6107f906d4c2979b17b5208b3130987bd73e715d/bin/utop: line 2: syntax error near unexpected token `C'
/Users/jordan/.esy/store-3.x.x/_install/opam_alpha__slash__utop-1.19.3-6107f906d4c2979b17b5208b3130987bd73e715d/bin/utop: line 2: `T�W%.7@IR[gt}���c(C'

It may be related, but vscode doesn't seem to be able to boot merlin either - it just shows [loading] endlessly; while the output shows:

undefined:1

SyntaxError: Unexpected end of JSON input
    at parse (<anonymous>)
    at /Users/jordan/.vscode/extensions/freebroccolo.reasonml-0.0.99/node_modules/lodash/lodash.js:5154:46
    at Interface._onLine (readline.js:245:5)
    at Interface.<anonymous> (readline.js:384:12)
    at Array.forEach (native)
    at Interface._normalWrite (readline.js:383:11)
    at Socket.ondata (readline.js:107:10)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
[Error - 10:11:09 pm] Connection to server got closed. Server will not be restarted.

I've tried uninstalling and reinstalling reason-cli on both master and beta-v-1.13.5, I've tried npm and yarn, switching to a different node version with nvm, updating npm, but none of these seem to have any effect.

Currently running:

jordwest commented 7 years ago

Github won't let me attach a tar of node_modules (too big) but I ran npm shrinkwrap inside reason-cli and dumped the result here: https://gist.github.com/jordwest/d820f280a6e30fd5cbc1f21bd295f3dc

jordwest commented 7 years ago

It's working again 🎉

Fixed by following @jordwalke's suggestion:

➜ rm -rf ~/.esy/   # <- This seems to be the solution
➜ npm uninstall -g reason-cli
➜ npm install -g git://github.com/reasonml/reason-cli.git#beta-v-1.13.5
➜ ocamlmerlin -version
The Merlin toolkit version 2.5.4, for Ocaml 4.02.3

Merlin is also now booting correctly in VSCode, and rtop starts.

It seems like somehow I ended up with an ocaml build that worked at first, but then got messed up somehow. It wasn't rebuilt when reason-cli was uninstalled/reinstalled, so the problem persisted until removing ~/.esy. Perhaps that suggestion could be added to the "ocaml is not installed correctly" error message? I'm happy to open a PR to do so.