-1

I just started using Elm. When I ran my hello world example(link to screenshot of code used given below) using elm-reactor, there is blank page on browser. There is also an error message on console describing it as a reference error (link to the screenshot given below). But, when using elm-make to create a html file from the code, it runs successfully.

Link to tutorial site referred to write the hello world example.

Please help me in finding the solution to the problem. If you need further information, just leave a comment.

Elm code used:

module Hello exposing (..)

import Html exposing ( text, Html )

main : Html a
main = text "Hello"

Error message on browser console:

ReferenceError: runElmProgram is not defined.

Browser output is blank screen.

glennsl
  • 28,186
  • 12
  • 57
  • 75
Transhap Higsn
  • 165
  • 4
  • 12
  • Please edit the question to include text snippets of the code and console output rather than relying on externally hosted screen shots, which may disappear over time. – Mike Godin Nov 21 '17 at 16:08
  • Okay @MikeGodin, will do that in a minute – Transhap Higsn Nov 21 '17 at 16:10
  • 1
    What happens if you change to `module Hello ...` and `Hello.elm`? (capital H) – Alex Lew Nov 22 '17 at 04:59
  • The same code fails to run on elm online editor as well. If the first line `module hello..` line is removed, it runs smoothly. – kaskelotti Nov 22 '17 at 05:44
  • Some GitHub issues suggest that you could be having these problems because of using outdated versions. Please try to install the latest elm-platform! – Isti115 Nov 22 '17 at 13:46
  • @AlexLew Your changes didn't help. Got an additional error at console though: `Loading failed for the – Transhap Higsn Nov 22 '17 at 18:59
  • @kaskelotti I don't know how you are doing it, but i'm still not able to do it. Error message after the changes suggested by you remains same as that for changes suggested by AlexLew. – Transhap Higsn Nov 22 '17 at 19:10
  • @kaskelotti I don't think the problem is due to the outdated version. Although, at first I was running 0.17, but even after updating it to 0.18 same problem persists. HTML file produced by elm-make is running successfully but elm-reactor way is not yielding any result. – Transhap Higsn Nov 22 '17 at 20:01
  • 1
    @Transhap I copied the code from your question and ran it with elm-reactor. With lowercase module name it fails, but not with the same error message as you have. By fixing that it runs nicely. Elm version is 0.18. – kaskelotti Nov 23 '17 at 05:12
  • I'd recommend you to start a fresh project, make sure the `elm-package.json` has elm version set to 0.18 and the command line tool in use is version 0.18. To see the version number type command `elm-reactor --help` – kaskelotti Nov 24 '17 at 07:52

2 Answers2

1

Thank you all for your suggestions. Maybe, it was due to the way I installed Elm (build from source). Solved it by installing elm again from scratch using npm.

Transhap Higsn
  • 165
  • 4
  • 12
0

In Elm module names and file names should start from a capital letter. Just rename your module to Hello and your file to Hello.elm.

gyzerok
  • 1,338
  • 2
  • 11
  • 26
  • I guess at this point it will be way easier to help you if you share your code in github repo. – gyzerok Nov 24 '17 at 17:29
  • 1
    Thank you @gyzerok. I don't think there is any need of it. I have sorted it out. It was probably due to the way I build Elm. – Transhap Higsn Nov 25 '17 at 19:16