New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unexpected "e" when trying hello world (elm-make 0.2, Elm Platform 0.15) #411

Closed
alphydan opened this Issue Sep 17, 2015 · 10 comments

Comments

Projects
None yet
2 participants
@alphydan

alphydan commented Sep 17, 2015

Not sure if it's the same issue as #218, but I encounter a very similar error on Ubuntu 14.04.

elm-make --help shows version elm-make 0.2 (Elm Platform 0.15.1)
elm shows version Elm Platform 0.15

I rm -r ~/.elm/ and also, removed everything found doing find . -type d -name "elm-stuff" in my directory with elm projects, following this suggestion.

When I run elm-reactor for a file with:

 import Html exposing (text)

 main =
   text "Hello, World!"

I also see:

unexpected "e"
expecting whitespace, a newline, reserved word 'as' or "("

Any ideas about what to try next?

@alphydan

This comment has been minimized.

Show comment
Hide comment
@alphydan

alphydan Sep 17, 2015

Also, here's the output for elm-make:
https://gist.github.com/alphydan/63b756c37dbeb0ae48cd

and here's what's in the elm-package.json:
https://gist.github.com/alphydan/f31ab760ae382ec89662

it shows that the "html" package is missing.
I tried elm-package install evancz/elm-html or elm-package install evancz/html but both say

Error: No versions of package 'evancz/elm-html' were found!
Is it spelled correctly?

Any tips appreciated.

alphydan commented Sep 17, 2015

Also, here's the output for elm-make:
https://gist.github.com/alphydan/63b756c37dbeb0ae48cd

and here's what's in the elm-package.json:
https://gist.github.com/alphydan/f31ab760ae382ec89662

it shows that the "html" package is missing.
I tried elm-package install evancz/elm-html or elm-package install evancz/html but both say

Error: No versions of package 'evancz/elm-html' were found!
Is it spelled correctly?

Any tips appreciated.

@jvoigtlaender

This comment has been minimized.

Show comment
Hide comment
@jvoigtlaender

jvoigtlaender Sep 26, 2015

Contributor

Tip: Make sure you have a consistent Elm install. Otherwise, any troubleshooting here is rather useless.

The fact that:

elm-make --help shows version elm-make 0.2 (Elm Platform 0.15.1)
elm shows version Elm Platform 0.15

means that something is seriously wrong with your install(s). Removing ~/.elm/ and elm-stuff directories is not sufficient here. That will remove project specific stuff, but not affect what elm executables you have lying around on your system.

Try to find those executables. Does your OS have something like a which command? Look at your PATH environment variable. What could be the reason that different versions of Elm (0.15 vs. 0.15.1) are found on invocations of different executables? Try, in this way, to find the old Elm Platform 0.15 installation. Remove it (or remove all its directories from PATH and possibly also from the ELM_HOME environment variable). Then, having made sure that whatever Elm tools you call, you always get Elm Platform 0.15.1 versions, repeat what you originally wanted to do.

Contributor

jvoigtlaender commented Sep 26, 2015

Tip: Make sure you have a consistent Elm install. Otherwise, any troubleshooting here is rather useless.

The fact that:

elm-make --help shows version elm-make 0.2 (Elm Platform 0.15.1)
elm shows version Elm Platform 0.15

means that something is seriously wrong with your install(s). Removing ~/.elm/ and elm-stuff directories is not sufficient here. That will remove project specific stuff, but not affect what elm executables you have lying around on your system.

Try to find those executables. Does your OS have something like a which command? Look at your PATH environment variable. What could be the reason that different versions of Elm (0.15 vs. 0.15.1) are found on invocations of different executables? Try, in this way, to find the old Elm Platform 0.15 installation. Remove it (or remove all its directories from PATH and possibly also from the ELM_HOME environment variable). Then, having made sure that whatever Elm tools you call, you always get Elm Platform 0.15.1 versions, repeat what you originally wanted to do.

@alphydan

This comment has been minimized.

Show comment
Hide comment
@alphydan

alphydan Sep 27, 2015

Thank you for the hint. Indeed,
which elm points to

/home/myusername/.cabal/bin/elm

but which elm-make points to

/usr/local/bin/elm-make

so I removed both, uninstalled the version I had installed with npm, sudo npm -g uninstall elm --save, and followed this tutorial to get things installed again (with 0.15.1), and adding:

    PATH=$PATH:/usr/local/Elm-Platform/0.15.1/.cabal-sandbox/bin

Unfortunately this hasn't solved this problem. I still see:

 $ which elm
/home/myuser/.cabal/bin/elm

and

$ which elm-make
 /usr/local/Elm-Platform/0.15.1/.cabal-sandbox/bin/elm-make

but for example, I can't see elm-reactor in there:

 $ ls /usr/local/Elm-Platform/0.15.1/.cabal-sandbox/bin/
  aeson-pretty  elm  elm-make  elm-package  elm-repl  glsl-pprint

I'm a pretty lost about what to try next. There seems to be no standard way to install in linux systems, (and cabal install elm-reactor installs the older version Elm Reactor 0.3.1 (Elm Platform 0.15) into /home/myusername/.cabal/bin

alphydan commented Sep 27, 2015

Thank you for the hint. Indeed,
which elm points to

/home/myusername/.cabal/bin/elm

but which elm-make points to

/usr/local/bin/elm-make

so I removed both, uninstalled the version I had installed with npm, sudo npm -g uninstall elm --save, and followed this tutorial to get things installed again (with 0.15.1), and adding:

    PATH=$PATH:/usr/local/Elm-Platform/0.15.1/.cabal-sandbox/bin

Unfortunately this hasn't solved this problem. I still see:

 $ which elm
/home/myuser/.cabal/bin/elm

and

$ which elm-make
 /usr/local/Elm-Platform/0.15.1/.cabal-sandbox/bin/elm-make

but for example, I can't see elm-reactor in there:

 $ ls /usr/local/Elm-Platform/0.15.1/.cabal-sandbox/bin/
  aeson-pretty  elm  elm-make  elm-package  elm-repl  glsl-pprint

I'm a pretty lost about what to try next. There seems to be no standard way to install in linux systems, (and cabal install elm-reactor installs the older version Elm Reactor 0.3.1 (Elm Platform 0.15) into /home/myusername/.cabal/bin

@jvoigtlaender

This comment has been minimized.

Show comment
Hide comment
@jvoigtlaender

jvoigtlaender Sep 27, 2015

Contributor

What BuildFromSource.hs script have you run? The "tutorial" you point to seems to have sent you to https://raw.githubusercontent.com/elm-lang/elm-platform/master/src/BuildFromSource.hs, which doesn't actually exist. You should have used https://raw.githubusercontent.com/elm-lang/elm-platform/master/installers/BuildFromSource.hs (which was changed rather fundamentally rather recently, so make sure to download it anew, even if you think you still have a good version from sometime earlier). And you should have used that script following the instructions from https://github.com/elm-lang/elm-platform. One important bit in those instructions (but not in the "tutorial") is that you absolutely have to set your system path to include /usr/local/Elm-Platform/0.15.1/.cabal-sandbox/bin before you run BuildFromSource.hs. If you don't do so, building elm-reactor will fail (as https://github.com/elm-lang/elm-platform is saying), which is exactly what you experienced: elm-reactor is missing in your /usr/local/Elm-Platform/0.15.1/.cabal-sandbox/bin at the end.

And also, I suspect that you didn't successfully remove your /home/myusername/.cabal/bin/elm. You say you removed it, but later which elm is still giving you /home/myuser/.cabal/bin/elm? There is nothing in BuildFromSource.hs (the correct one I'm pointing to above) that could put an elm executable in that place. So either you didn't manage to actually remove it in the first place (have you tried which elm before running BuildFromSource.hs?), or there was something else in the tutorial that shouldn't have been done. Point is, BuildFromSource.hs wouldn't put something like that there.

Contributor

jvoigtlaender commented Sep 27, 2015

What BuildFromSource.hs script have you run? The "tutorial" you point to seems to have sent you to https://raw.githubusercontent.com/elm-lang/elm-platform/master/src/BuildFromSource.hs, which doesn't actually exist. You should have used https://raw.githubusercontent.com/elm-lang/elm-platform/master/installers/BuildFromSource.hs (which was changed rather fundamentally rather recently, so make sure to download it anew, even if you think you still have a good version from sometime earlier). And you should have used that script following the instructions from https://github.com/elm-lang/elm-platform. One important bit in those instructions (but not in the "tutorial") is that you absolutely have to set your system path to include /usr/local/Elm-Platform/0.15.1/.cabal-sandbox/bin before you run BuildFromSource.hs. If you don't do so, building elm-reactor will fail (as https://github.com/elm-lang/elm-platform is saying), which is exactly what you experienced: elm-reactor is missing in your /usr/local/Elm-Platform/0.15.1/.cabal-sandbox/bin at the end.

And also, I suspect that you didn't successfully remove your /home/myusername/.cabal/bin/elm. You say you removed it, but later which elm is still giving you /home/myuser/.cabal/bin/elm? There is nothing in BuildFromSource.hs (the correct one I'm pointing to above) that could put an elm executable in that place. So either you didn't manage to actually remove it in the first place (have you tried which elm before running BuildFromSource.hs?), or there was something else in the tutorial that shouldn't have been done. Point is, BuildFromSource.hs wouldn't put something like that there.

@jvoigtlaender

This comment has been minimized.

Show comment
Hide comment
@jvoigtlaender

jvoigtlaender Sep 27, 2015

Contributor

Re: "There seems to be no standard way to install in linux systems"; actually the README of https://github.com/elm-lang/elm-platform describes what should be that standard way. If that's not working, it would be good for us to know how exactly it's failing, so that we can repair.

Contributor

jvoigtlaender commented Sep 27, 2015

Re: "There seems to be no standard way to install in linux systems"; actually the README of https://github.com/elm-lang/elm-platform describes what should be that standard way. If that's not working, it would be good for us to know how exactly it's failing, so that we can repair.

@alphydan

This comment has been minimized.

Show comment
Hide comment
@alphydan

alphydan Sep 28, 2015

@jvoigtlaender thank you for your suggestions and ideas. I had used the updated:

https://github.com/elm-lang/elm-platform/blob/master/installers/BuildFromSource.hs

while following the ubuntu tutorial.

you absolutely have to set your system path to include /usr/local/Elm-Platform/0.15.1/.cabal-sandbox/bin before you run BuildFromSource.hs

I'm afraid I did just the opposite. Re-reading, I think it's clear that's how it should be, but the npm install threw me off track.

In particular, when reading the elm-platform readme it says:

Second, if you are on some linux OS and just want to use Elm, use the npm installer and be very very attentive to the README there

But that installs 0.15 and not 0.15.1. Also, further down it says

We will soon run a script that creates a directory called Elm-Platform/0.15.1/* and builds all the necessary things.

so one is not sure which method to follow. The npm method? or the Elm-Platform/0.15.1/* from source? The fact that two methods are on the same README may be part of where my confusion came from. Here's what I ended up doing:


cleaned up all cabal packages, and deleted various things: rm -r /usr/local/Elm-Platform, rm /usr/local/bin/cabal, rm /usr/local/bin/elm-reactor, and other elm binaries there. After hours of installing conflicting libraries, I finally found a way:

I've written the detailed instructions which worked for me in a GIST:

https://gist.github.com/alphydan/265e3f0b4074a08404ee

In case it's useful for other people on Ubuntu 14.04 (feel free to copy any of it).

Maybe a quick note on things which were not explicit enough for me in the current instructions:

  • Which cabal version? where and how?
  • only npm or only from source?
  • $PATH for Elm-Platform and also for cabal
  • what todo about regex-compat-0.95.1?

Thank you.

alphydan commented Sep 28, 2015

@jvoigtlaender thank you for your suggestions and ideas. I had used the updated:

https://github.com/elm-lang/elm-platform/blob/master/installers/BuildFromSource.hs

while following the ubuntu tutorial.

you absolutely have to set your system path to include /usr/local/Elm-Platform/0.15.1/.cabal-sandbox/bin before you run BuildFromSource.hs

I'm afraid I did just the opposite. Re-reading, I think it's clear that's how it should be, but the npm install threw me off track.

In particular, when reading the elm-platform readme it says:

Second, if you are on some linux OS and just want to use Elm, use the npm installer and be very very attentive to the README there

But that installs 0.15 and not 0.15.1. Also, further down it says

We will soon run a script that creates a directory called Elm-Platform/0.15.1/* and builds all the necessary things.

so one is not sure which method to follow. The npm method? or the Elm-Platform/0.15.1/* from source? The fact that two methods are on the same README may be part of where my confusion came from. Here's what I ended up doing:


cleaned up all cabal packages, and deleted various things: rm -r /usr/local/Elm-Platform, rm /usr/local/bin/cabal, rm /usr/local/bin/elm-reactor, and other elm binaries there. After hours of installing conflicting libraries, I finally found a way:

I've written the detailed instructions which worked for me in a GIST:

https://gist.github.com/alphydan/265e3f0b4074a08404ee

In case it's useful for other people on Ubuntu 14.04 (feel free to copy any of it).

Maybe a quick note on things which were not explicit enough for me in the current instructions:

  • Which cabal version? where and how?
  • only npm or only from source?
  • $PATH for Elm-Platform and also for cabal
  • what todo about regex-compat-0.95.1?

Thank you.

@alphydan alphydan closed this Sep 28, 2015

@jvoigtlaender

This comment has been minimized.

Show comment
Hide comment
@jvoigtlaender

jvoigtlaender Sep 29, 2015

Contributor

Thanks for staying through this, and for the feedback. I'll try to improve the https://github.com/elm-lang/elm-platform README based on it.

Some direct replies:

  • The intention is definitely either npm or build from source. So if npm is working for a user, they shouldn't even read onwards in the README.
  • Which cabal version? The README says "1.18 or higher", and that's still the requirement. But it's true the README is not comprehensive when it comes to telling people how to get such a version (or Haskell in general). There would be just too many varieties to cover. So there's not much to be done except telling people that they should try to get the Haskell platform as a whole. We could point people to https://www.haskell.org/platform/contents.html so that they can easily check whether the platform version their distribution installs is recent enough.
  • The $PATH business... well, I guess people installing from source will simply have to live with having to deal with such low-level stuff.
  • The thing about regex-compat-0.95.1, I've not seen that before at all. I'll watch out for it.

Finally, I'm confused by your assertion that the npm installer only installs 0.15 and not 0.15.1. That shouldn't be true. The npm installer (https://www.npmjs.com/package/elm, https://github.com/kevva/elm-bin) was updated to Elm version 0.15.1 pretty much immediately after that version was released.

Contributor

jvoigtlaender commented Sep 29, 2015

Thanks for staying through this, and for the feedback. I'll try to improve the https://github.com/elm-lang/elm-platform README based on it.

Some direct replies:

  • The intention is definitely either npm or build from source. So if npm is working for a user, they shouldn't even read onwards in the README.
  • Which cabal version? The README says "1.18 or higher", and that's still the requirement. But it's true the README is not comprehensive when it comes to telling people how to get such a version (or Haskell in general). There would be just too many varieties to cover. So there's not much to be done except telling people that they should try to get the Haskell platform as a whole. We could point people to https://www.haskell.org/platform/contents.html so that they can easily check whether the platform version their distribution installs is recent enough.
  • The $PATH business... well, I guess people installing from source will simply have to live with having to deal with such low-level stuff.
  • The thing about regex-compat-0.95.1, I've not seen that before at all. I'll watch out for it.

Finally, I'm confused by your assertion that the npm installer only installs 0.15 and not 0.15.1. That shouldn't be true. The npm installer (https://www.npmjs.com/package/elm, https://github.com/kevva/elm-bin) was updated to Elm version 0.15.1 pretty much immediately after that version was released.

@alphydan

This comment has been minimized.

Show comment
Hide comment
@alphydan

alphydan Oct 1, 2015

@jvoigtlaender

Thanks for the comments and README update. I thought I finally had it after doing all the steps in my gist. Unfortunately, elm-reactor failed to install (or perhaps to make it into the relevant paths). Here's what I see:

$ elm
Elm Platform 0.15.1 - a way to run all Elm tools
$ which elm
/home/user/Documentos/code/Elm-Platform/0.15.1/.cabal-sandbox/bin/elm

$ elm-make --help
elm-make 0.2 (Elm Platform 0.15.1)
$ which elm-make
/home/user/Documentos/code/Elm-Platform/0.15.1/.cabal-sandbox/bin/elm-make

elm-package and elm-repl are also there in the right version. However elm-compiler and elm-reactor are not there.

 $ echo $ELM_HOME

is empty, so I'm not sure if the issue is about updating that variable? If so, where should it point to? Elm-Platform/0.15.1/.cabal-sandbox/x86_64-osx-ghc-7.8.3/elm-reactor-0.3.2/ does not exist in my distro, but this one does: /Elm-Platform/0.15.1/.cabal-sandbox/lib/x86_64-linux-ghc-7.6.3/

That directory, however, does not have elm-reactor inside it either.

If all this doesn't work, I'll give another try to the npm method.

alphydan commented Oct 1, 2015

@jvoigtlaender

Thanks for the comments and README update. I thought I finally had it after doing all the steps in my gist. Unfortunately, elm-reactor failed to install (or perhaps to make it into the relevant paths). Here's what I see:

$ elm
Elm Platform 0.15.1 - a way to run all Elm tools
$ which elm
/home/user/Documentos/code/Elm-Platform/0.15.1/.cabal-sandbox/bin/elm

$ elm-make --help
elm-make 0.2 (Elm Platform 0.15.1)
$ which elm-make
/home/user/Documentos/code/Elm-Platform/0.15.1/.cabal-sandbox/bin/elm-make

elm-package and elm-repl are also there in the right version. However elm-compiler and elm-reactor are not there.

 $ echo $ELM_HOME

is empty, so I'm not sure if the issue is about updating that variable? If so, where should it point to? Elm-Platform/0.15.1/.cabal-sandbox/x86_64-osx-ghc-7.8.3/elm-reactor-0.3.2/ does not exist in my distro, but this one does: /Elm-Platform/0.15.1/.cabal-sandbox/lib/x86_64-linux-ghc-7.6.3/

That directory, however, does not have elm-reactor inside it either.

If all this doesn't work, I'll give another try to the npm method.

@jvoigtlaender

This comment has been minimized.

Show comment
Hide comment
@jvoigtlaender

jvoigtlaender Oct 1, 2015

Contributor

Hmm, so maybe the elm-compiler build failed due to the regex-compat-0.95.1 issue, whatever that issue is. It's a bit strange that you got no more explicit failure message about elm-compiler not being built successfully. But maybe the verbosity is set to a low level in the build script, I don't know off the top of my head.

What I can say is that ELM_HOME is not responsible for the situation. That environment variable comes into play much later, when elm-reactor is already running. Its presence or absence or value will not affect the build of elm-reactor (or elm-compiler).

For the record, though it won't help in your situation, the ELM_HOME variable must be set to a directory /this/path such that the file /this/path/reactor/_reactor/debug.js exists. (Other stuff must also exist around there, but the existence of that file at that place will tell you that you have the right /this/path.)

Contributor

jvoigtlaender commented Oct 1, 2015

Hmm, so maybe the elm-compiler build failed due to the regex-compat-0.95.1 issue, whatever that issue is. It's a bit strange that you got no more explicit failure message about elm-compiler not being built successfully. But maybe the verbosity is set to a low level in the build script, I don't know off the top of my head.

What I can say is that ELM_HOME is not responsible for the situation. That environment variable comes into play much later, when elm-reactor is already running. Its presence or absence or value will not affect the build of elm-reactor (or elm-compiler).

For the record, though it won't help in your situation, the ELM_HOME variable must be set to a directory /this/path such that the file /this/path/reactor/_reactor/debug.js exists. (Other stuff must also exist around there, but the existence of that file at that place will tell you that you have the right /this/path.)

@alphydan

This comment has been minimized.

Show comment
Hide comment
@alphydan

alphydan Oct 4, 2015

it was all a matter of having the wrong version of ghc and cabal. I wrote down the instructions which worked for me in a blog post:

http://alphydan.svbtle.com/elm-lang-on-ubuntu-14-04

alphydan commented Oct 4, 2015

it was all a matter of having the wrong version of ghc and cabal. I wrote down the instructions which worked for me in a blog post:

http://alphydan.svbtle.com/elm-lang-on-ubuntu-14-04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment