Elm 0.15.1 Linux - elm-reactor error

375 views
Skip to first unread message

Alexander Gosselin

unread,
Oct 25, 2015, 10:46:17 PM10/25/15
to Elm Discuss
I am brand new to Elm, running Linux Mint.

I started by installing elm from npm:

$ sudo npm install -g elm

The install went without any errors. The readme on the elm-platform github page says to look closely at the readme, but I didn't see any readme on the npm page.

I unzipped elm-architecture-tutorial and tried to start elm-reactor in the */1/ directory to see if I could run the counter example. I got the following error.

$ elm-reactor

module.js:340
    throw err;
          ^
Error: Cannot find module '/usr/local/lib/node_modules/elm/index'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/elm/binwrap.js:2:17)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)

I then tried making sure that my .bashrc pointed to the .cabal-sandbox folder inside /usr/local/lib/node_modules/elm, where npm installs Elm. I also used BuildFromSource.hs inside the same folder. I still get the same error.

Can I get some pointers here? I'm not ready to give up.

Janis Voigtländer

unread,
Oct 26, 2015, 2:31:48 AM10/26/15
to elm-d...@googlegroups.com

The README this is talking about is this one: https://github.com/kevva/elm-bin/blob/master/readme.md

What it is telling you to pay attention to is specifically the instruction about setting ELM_HOME there.

That you don’t see the README on https://www.npmjs.com/package/elm is cause by the fact that Richared published to npm from a fork of the above repo (https://github.com/rtfeldman/elm-bin), but didn’t include the README in his fork. This is unfortunate, and I’ll open a GitHub issue for this.


--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Janis Voigtländer

unread,
Oct 26, 2015, 3:48:15 AM10/26/15
to elm-d...@googlegroups.com

One thing you could try immediately is to run

sudo npm install -g e...@2.0.0

instead of

sudo npm install -g elm

That should give you the latest version of the installer before Richard’s experimental release. (The version scheme is strange, but indeed @2.0.0 will give you Elm version 0.15.1. Using elm instead of e...@2.0.0 will actually give you e...@0.15.1-beta, which is Richard’s experiment with an alternative way of packaging Elm version 0.15.1.)


2015-10-26 3:46 GMT+01:00 Alexander Gosselin <alexande...@gmail.com>:

--

Alexander Gosselin

unread,
Oct 26, 2015, 10:02:57 AM10/26/15
to Elm Discuss
Hey Janis,

Your solution worked like a charm. I am now able to run the tutorial programs.

Thank you very much.

Richard Feldman

unread,
Oct 26, 2015, 4:16:14 PM10/26/15
to Elm Discuss
This is very strange...curious to get some additional info here.

First, for me at least, npm install -g elm definitely installs 2.0.0, not 0.15.1-beta:

$ npm install -g elm
/usr/local/bin/elm -> /usr/local/lib/node_modules/elm/bin/elm
/usr/local/bin/elm-make -> /usr/local/lib/node_modules/elm/bin/elm-make
/usr/local/bin/elm-package -> /usr/local/lib/node_modules/elm/bin/elm-package
/usr/local/bin/elm-reactor -> /usr/local/lib/node_modules/elm/bin/elm-reactor
/usr/local/bin/elm-repl -> /usr/local/lib/node_modules/elm/bin/elm-repl


> elm@2.0.0 postinstall /usr/local/lib/node_modules/elm
> node lib/install.js


 
elm pre-build test passed successfully
 
elm-make pre-build test passed successfully
 
elm-package pre-build test passed successfully
 
elm-reactor pre-build test passed successfully
 
elm-repl pre-build test passed successfully


elm@2
.0.0 /usr/local/lib/node_modules/elm
├── async-each-series@0.1.1
├── logalot@2.1.0 (figures@1.4.0, squeak@1.3.0)
└── bin-wrapper@3.0.2 (os-filter-obj@1.0.3, lazy-req@1.1.0, each-async@1.1.1, bin-check@2.0.0, bin-version-check@2.1.0, download@4.4.1)


Janis, can you confirm that it's doing something different for you? That sounds like very surprising behavior!

Second, assuming that it tried to get 2.0.0 the first time, I'm surprised that sudo npm install -g e...@2.0.0 worked, while sudo npm install -g elm did not, since they should have been doing the same thing.

Alexander, were there any other steps you took in between running those two commands that might have impacted the success the second time around?

Sorry for the hassle...still getting this sorted out!

Janis Voigtländer

unread,
Oct 26, 2015, 4:45:01 PM10/26/15
to elm-d...@googlegroups.com

Now I am surprised. Why do you think that sudo npm install -g elm and sudo npm install -g e...@2.0.0 would do the exact same thing, when https://www.npmjs.com/package/elm says that (I assume by some action of yours): “0.15.1-beta is the latest of 11 releases”. Isn’t it then to be expected that sudo npm install -g elm is equivalent to sudo npm install -g e...@0.15.1-beta?

Richard Feldman

unread,
Oct 26, 2015, 4:58:17 PM10/26/15
to Elm Discuss
It would be if sudo npm -g install elm installed the package listed as "latest," but empirically it does not. :)

Certainly two things are true:
  1. If I run npm info elm it says 'dist-tags': { latest: '0.15.1-beta' }
  2. If I run npm install -g elm it installs 2.0.0 nonetheless (see the terminal output I posted earlier).
Surprising or no, that's what npm chooses to install.

Rereading the OP, I'm not actually sure there actually was a .cabal-sandbox directory present (certainly one wouldn't have to be in order to point PATH at it), or if there was, that npm created it (as opposed to a previous attempt to build from source).

Janis Voigtländer

unread,
Oct 26, 2015, 5:04:07 PM10/26/15
to elm-d...@googlegroups.com

You say:

Rereading the OP, I’m not actually sure there actually was a .cabal-sandbox directory present (certainly one wouldn’t have to be in order to point PATH at it), or if there was, that npm created it (as opposed to a previous attempt to build from source).

The OP wrote:

I then tried making sure that my .bashrc pointed to the .cabal-sandbox folder inside /usr/local/lib/node_modules/elm, where npm installs Elm. I also used BuildFromSource.hs inside the same folder. I still get the same error.

They had a .cabal-sandbox folder inside /usr/local/lib/node_modules/elm. I find this hard to reconcile with “probably that .cabal-sandbox folder came from something else than their use of the npm installer”.

So, while npm install -g elm on your machine might install 2.0.0, all evidence points to
npm install -g elm installing 0.15.1-beta on their machine.


--

Richard Feldman

unread,
Oct 26, 2015, 6:18:12 PM10/26/15
to Elm Discuss
Fair point, although I have no idea why npm would choose to install a different version of the same package depending on which machine ran the exact same command! That would sound like a pretty severe bug for a tool as mature as npm.

I guess at this point the best course of action is to wait for further clarification from OP.

Alexander Gosselin

unread,
Oct 26, 2015, 6:26:19 PM10/26/15
to elm-d...@googlegroups.com
Hi,

I had tried to install Elm-Platform in my home directory earlier using BuildFromSource.hs, and I expected there would be a .cabal sandbox in the */Elm-Platform/<version>/ folder created by BuildFromSource.hs. I pre-emptively changed my .bashrc file before running BuildFromSource.hs in the node_modules/elm folder after running npm install -g elm. I hope that clarifies things.

On Mon, Oct 26, 2015 at 3:18 PM, Richard Feldman <richard....@gmail.com> wrote:
Fair point, although I have no idea why npm would choose to install a different version of the same package depending on which machine ran the exact same command! That would sound like a pretty severe bug for a tool as mature as npm.

I guess at this point the best course of action is to wait for further clarification from OP.

--
You received this message because you are subscribed to a topic in the Google Groups "Elm Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elm-discuss/jY9BNp5HEY4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elm-discuss...@googlegroups.com.
Message has been deleted

Janis Voigtländer

unread,
Oct 26, 2015, 6:30:34 PM10/26/15
to elm-d...@googlegroups.com

So there was a BuildFromSource.hs file in the node_modules/elm folder that you did not put there yourself?

To me, that rules out that e...@2.0.0 was installed, because that does not contain the BuildFromSource.hs file.


--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss...@googlegroups.com.

Alexander Gosselin

unread,
Oct 26, 2015, 6:35:53 PM10/26/15
to elm-d...@googlegroups.com
Hi Janis,

There was definitely a BuildFromSource.hs file in the elm directory after 'npm install -g helm'.

Enis BAYRAMOĞLU

unread,
Nov 4, 2015, 2:28:02 AM11/4/15
to Elm Discuss
Hi everyone, I just wanted to let you know that this issue stands. I've found myself (along with 2 of my colleagues that I was trying to sell Elm to) in a very confusing situation when I tried to compile Evan's start-app example yesterday. After spending a lot of time trying to realize why elm-package install didn't work, I tried to update my elm installation, which made it all worse with the issue in this thread. It's even more confusing since the readme at https://github.com/elm-lang/elm-platform mentions a readme that is supposed to say something about an ELM_HOME. I've finally solved the problem following the e...@2.0.0 suggestion in this thread, but I'm not sure if I'll be able to sell Elm to those colleagues ever again :(

In any case, thanks a lot for the suggested solution and for your contributions to Elm in general.

Janis Voigtländer

unread,
Nov 4, 2015, 2:37:13 AM11/4/15
to elm-d...@googlegroups.com

It’s even more confusing since the readme at https://github.com/elm-lang/elm-platform mentions a readme that is supposed to say something about an ELM_HOME.

FWIW, there’s already a pull request (https://github.com/elm-lang/elm-platform/pull/98) to remove that mention.

Chris Hildebrand

unread,
Nov 5, 2015, 12:46:03 AM11/5/15
to Elm Discuss
I wanted to add that I also encountered this issue and also resolved it by installing @2.0.0 (running Ubuntu 14.04)

Matteo Bertini

unread,
Nov 5, 2015, 8:57:05 AM11/5/15
to Elm Discuss


Il giorno lunedì 26 ottobre 2015 03:46:17 UTC+1, Alexander Gosselin ha scritto:
I am brand new to Elm, running Linux Mint.

I started by installing elm from npm:

$ sudo npm install -g elm

The install went without any errors. The readme on the elm-platform github page says to look closely at the readme, but I didn't see any readme on the npm page.

I unzipped elm-architecture-tutorial and tried to start elm-reactor in the */1/ directory to see if I could run the counter example. I got the following error.

$ elm-reactor

module.js:340
    throw err;
          ^
Error: Cannot find module '/usr/local/lib/node_modules/elm/index'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/elm/binwrap.js:2:17)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)



Same error here (whithout -g, I had a working non global install) after and upgrade, resolved with:

$ npm install bin-wrapper

that fixed it all
 

Matteo Bertini

unread,
Nov 5, 2015, 8:58:15 AM11/5/15
to Elm Discuss
Non exactly the same in fact... ops

module.js:339
    throw err;
    ^

Error: Cannot find module 'bin-wrapper'
    at Function.Module._resolveFilename (module.js:337:15)
    at Function.Module._load (module.js:287:25)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (/home/naufraghi/node_modules/elm/lib/index.js:4:18)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)

    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)

Janis Voigtländer

unread,
Nov 5, 2015, 9:23:11 AM11/5/15
to elm-d...@googlegroups.com

Can you please check whether what you were trying to install there was e...@2.0.0 or e...@0.15.1?

The mention of bin-wrapper lets me suspect you were getting e...@2.0.0 (which is the “old” npm installer, but also installs Elm version 0.15.1, and seems to be working quite well so far for many others), whereas the error reported and encountered by others in this thread was specific to e...@0.15.1 (which is the “new” npm installer, which still has some problems).


--

Richard Feldman

unread,
Nov 6, 2015, 1:34:58 PM11/6/15
to Elm Discuss
This should be fixed in e...@0.15.1-beta4 - sorry about that! Can anyone who has been having this issue try installing that version and and let me know if it solves it?
Reply all
Reply to author
Forward
0 new messages