Skip to content
This repository has been archived by the owner. It is now read-only.

Error when generating the html output: commitAndReleaseBuffer: invalid argument (invalid character) #40

Closed
grzegorzbalcerek opened this issue Aug 14, 2015 · 11 comments

Comments

Projects
None yet
@grzegorzbalcerek
Copy link

commented Aug 14, 2015

I am trying to compile a simple program and I am getting an error when generating the html output.
Here is a simple session, where I start with a folder that contains only the source file.

C:\Users\grzes\tmp>dir
 Volume in drive C is Windows8_OS
 Volume Serial Number is 22AA-55EE

 Directory of C:\Users\grzes\tmp

2015-08-14  02:34    <DIR>          .
2015-08-14  02:34    <DIR>          ..
2015-08-14  02:32                76 Hello.elm
               1 File(s)             76 bytes
               2 Dir(s)   9 035 051 008 bytes free

C:\Users\grzes\tmp>more Hello.elm
module Hello where
import Markdown
main = Markdown.toElement """Hello"""

C:\Users\grzes\tmp>elm package install evancz/elm-markdown --yes
Downloading elm-lang/core
Downloading evancz/elm-html
Downloading evancz/elm-markdown
Downloading evancz/virtual-dom
Packages configured successfully!

C:\Users\grzes\tmp>elm make Hello.elm --output Hello.html
Success! Compiled 38 modules.
elm-make.exe: Hello.html: commitAndReleaseBuffer: invalid argument (invalid character)

C:\Users\grzes\tmp>

I am using elm 0.15.1 on Windows.

C:\Users\grzes\tmp>elm
Elm Platform 0.15.1 - a way to run all Elm tools
...

I have installed from source.

The HTML is generated but the browser shows a blank page with no content.

C:\Users\grzes\tmp>dir
 Volume in drive C is Windows8_OS
 Volume Serial Number is 22AA-55EE

 Directory of C:\Users\grzes\tmp

2015-08-14  02:35    <DIR>          .
2015-08-14  02:35    <DIR>          ..
2015-08-14  02:34               426 elm-package.json
2015-08-14  02:35    <DIR>          elm-stuff
2015-08-14  02:32                76 Hello.elm
2015-08-14  02:35           193 455 Hello.html
               3 File(s)        193 957 bytes
               3 Dir(s)   9 030 238 208 bytes free

C:\Users\grzes\tmp>

The error is not shown when generating JS.

C:\Users\grzes\tmp>elm make Hello.elm --output Hello.js
Success! Compiled 0 modules.
Successfully generated Hello.js
@grzegorzbalcerek

This comment has been minimized.

Copy link
Author

commented Aug 14, 2015

Not sure if that might be important. But my Windows system is in Polish. Could that introduce an invalid character somewhere?

@jvoigtlaender

This comment has been minimized.

Copy link
Contributor

commented Aug 14, 2015

If it is a character encoding problem caused by your language setting, maybe this is relevant or could even help your situation.

@texastoland

This comment has been minimized.

Copy link

commented Aug 20, 2015

I get this trying to compile on Windows with Unicode characters c.f. Hakyll FAQ.

@artgitt

This comment has been minimized.

@stormont

This comment has been minimized.

Copy link

commented Nov 8, 2015

I also get this error doing a straight copy/paste of the HTTP Tasks part of the Reactivity tutorial: http://elm-lang.org/guide/reactivity

Using elm-make to compile to elm.js works fine; it only exhibits the error when compiling to HTML.

Specifically, the HTML generation stops shortly after the third real usage of the "smartypants" field. Comparing to the full elm.js, it looks like it's halting on these characters:

  • return text.replace(/--/g,"—").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"â€�").replace(/\.{3}/g,"…")};

The HTML output simply ends with this:

  • return text.replace(/--/g,"

(I'm in the US, if that helps with tracking down the necessary encodings.)

Edit: I just wrote up a blog post for working around this until the bug is resolved. A simple trick is to generate the elm.js file and just import it into an HTML page, as the error seems to only affect the HTML generation, not the JS generation.

@deadfoxygrandpa

This comment has been minimized.

Copy link

commented Dec 17, 2015

I'm now seeing this error on Windows 7 using Elm 0.16.0. I was able to resolve it by changing the code page to 65001

@adicirstei

This comment has been minimized.

Copy link

commented Jan 12, 2016

Any news on this?

@ianrae

This comment has been minimized.

Copy link

commented Jan 30, 2016

Seeing this error on Windows 8 and Elm 0.16. Am working through http://elm-by-example.org/chapter1helloworld.html. HelloWorld1, 2, and 3 work fine. HelloWorld4 (which requires elm-markdown) has the error.

@nmdanny

This comment has been minimized.

Copy link

commented Feb 3, 2016

Encountered this error on the reactivity guide at the HTTP Tasks part.

@philderbeast

This comment has been minimized.

Copy link

commented Feb 6, 2016

As reported by others in this thread and from the Hakyll link, on windows running chcp 65001 fixed this problem for me.

@evancz

This comment has been minimized.

Copy link
Contributor

commented May 12, 2016

I believe @jvoigtlaender resolved this, and the fix came out with 0.17. We can open again if it persists.

@evancz evancz closed this May 12, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.