Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

elm get-started documentation "cannot find module"

Tags:

elm

Hello I just follow the doc from: http://elm-lang.org/get-started but I'm blocked in the finding module part:

$ mkdir elm
$ cd elm
$ elm package install
  Some new packages are needed. Here is the upgrade plan.

    Install:
      elm-lang/core 4.0.1

  Do you approve of this plan? (y/n) y
  Downloading elm-lang/core
  Packages configured successfully!

I get some simple example:

$ wget https://raw.githubusercontent.com/elm-lang/elm-lang.org/master/src/examples/buttons.elm
  ... Enregistre : «buttons.elm»

  buttons.elm            100%[===========================>]     495  --.-KB/s    in 0s
  2016-05-26 09:32:19 (150 MB/s) - «buttons.elm» enregistré [495/495]

I get a missing module Errror:

$ elm-make buttons.elm
  I cannot find module 'Html'.

  Module 'Main' is trying to import it.

  Potential problems could be:
    * Misspelled the module name
    * Need to add a source directory or new dependency to elm-package.json
  (venv)luis@spinoza:~/lab/sandbox/elm
$

I can't find where in the documentation is explain the connexion from

import xxx Exposing yyy

And the equivalent of

$ pip install xxx
like image 473
user3313834 Avatar asked May 26 '16 07:05

user3313834


1 Answers

You need to import the elm-lang/html package using elm package install elm-lang/html.

To find out which package you need when you receive such an eror from the compiler, you could go to http://package.elm-lang.org/ and, doing a little search, finding out which package is exposing the module you need by looking in the right column when you are in the details of a package.

For example here you'll see that the elm-lang/html package is exposing the following modules: Html, Html.App, Html.Attributes, Html.Events and Html.Lazy.

There is also an issue asking to improve the connection between the module and the package that is exposing it, so the compiler could help more during project bootstrap

like image 159
marcosh Avatar answered Nov 15 '22 09:11

marcosh