elm-repl icon indicating copy to clipboard operation
elm-repl copied to clipboard

"hGetContents: invalid argument" on Windows 10

Open logicmason opened this issue 9 years ago • 6 comments

I just installed elm 0.18.0 via its official installer and found that even echoing a single number or 0 + 1 in the repl causes it to crash:

D:\prog>elm repl
---- elm-repl 0.18.0 -----------------------------------------------------------
 :help for help, :exit to exit, more at <https://github.com/elm-lang/elm-repl>
--------------------------------------------------------------------------------
> 0 + 1
elm-repl.exe: fd:4: hGetContents: invalid argument (invalid byte sequence)

D:\prog>

Windows 10, working node (v4.4.4) and npm (v4.0.2). I get the same crash running via the command prompt or the VS2015 shell. Locale is zh_TW.UTF-8.

logicmason avatar Nov 24 '16 17:11 logicmason

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

process-bot avatar Nov 24 '16 17:11 process-bot

What happens if you try to use elm-reactor or elm-make on a file? You can try it with the examples from https://github.com/evancz/elm-architecture-tutorial/

evancz avatar Nov 24 '16 18:11 evancz

Very strange! I copied 01-button.elm into a file of the same name in my current directory, ran elm make 01-button.elm and it compiled. Then I tried firing up elm repl and it worked!

Opening another shell, the repl still works. However, trying the repl from the root directory of my d: drive, it failed. I tried running elm make and asked me to install some files, which also failed:

D:\>elm make prog\01-button.elm
Some new packages are needed. Here is the upgrade plan.

  Install:
    elm-lang/core 5.0.0
    elm-lang/html 2.0.0
    elm-lang/virtual-dom 2.0.1

Do you approve of this plan? [Y/n] Y
Starting downloads...

  ??elm-lang/virtual-dom 2.0.1
  ??elm-lang/html 2.0.0
elm-make.exe: elm-lang-core-d9b2e36: MoveFileEx "elm-lang-core-d9b2e36" "elm-lang\\core\\5.0.0": permission denied (存取被拒。)

Edit: the permissions issue is due to elm package getting blocked by McAfee LiveSafe and is unrelated to the repl bug. I'm leaving it in here so as to be helpful to the next Windows user to see the permission denied error.

logicmason avatar Nov 24 '16 18:11 logicmason

The permissions issue is the same as discussed here.

The invalid byte sequence issue appears identical to #98. Perhaps a version of Elm released since that issue was closed reintroduced the bug, or the scope of the issue wasn't clear when it was closed.

logicmason avatar Nov 25 '16 16:11 logicmason

Does their fix work for you?

$ LANG=en_US.UTF-8 elm-repl

And then try again.

evancz avatar Nov 30 '16 00:11 evancz

That definitely wouldn't work on Windows :)

From what I can tell the initial problem I mentioned at the top of the thread is #98 and not Windows specific. It's got to be a locale issue. Unfortunately, changing locales may take some work since my whole dev environment and several dependencies are in Traditional Chinese. For now I think I'll hold off on a deep-dive into Elm, but I'll keep an eye out for any fixes for the internationalization issues!

logicmason avatar Nov 30 '16 05:11 logicmason