Skip to content
This repository has been archived by the owner on Aug 23, 2018. It is now read-only.

"hGetContents: invalid argument" on Windows 10 #140

Open
logicmason opened this issue Nov 24, 2016 · 6 comments
Open

"hGetContents: invalid argument" on Windows 10 #140

logicmason opened this issue Nov 24, 2016 · 6 comments

Comments

@logicmason
Copy link

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.

@process-bot
Copy link

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.

@evancz
Copy link
Contributor

evancz commented Nov 24, 2016

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/

@logicmason
Copy link
Author

logicmason commented Nov 24, 2016

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
Copy link
Author

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.

@evancz evancz changed the title 0 +1 fails on fresh install of elm 0.18.0 hGetContents: invalid argument (invalid byte sequence) Nov 30, 2016
@evancz evancz changed the title hGetContents: invalid argument (invalid byte sequence) "hGetContents: invalid argument" on Windows 10 Nov 30, 2016
@evancz
Copy link
Contributor

evancz commented Nov 30, 2016

Does their fix work for you?

$ LANG=en_US.UTF-8 elm-repl

And then try again.

@logicmason
Copy link
Author

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!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants