I can not find the module 'Graphics.Element'

I'm trying to play a little with Knit (0.17). But I can not run this simple example:

import Graphics.Element exposing (..) main = show "Hello!" 

When starting elm reactor , the following error is displayed:

I can not find the module "Graphics.Element".

The 'Main' module is trying to import it.

Possible problems may be:

  • Fixed module name
  • You must add the source directory or a new dependency in elm-package.json

I executed the elm package install evancz/elm-graphics and it was executed successfully. I also see this when opening localhost: 8000 under the Dependencies sidebar.

When looking at other examples, they do the import in the same way.

What could cause the problem?

+8
elm
source share
2 answers

In version 0.17, the module name changed to Element , and now you will need to convert the graphic elements to Html. Try changing the code to the following:

 import Element exposing (..) main = toHtml <| show "Hello!" 
+19
source share

According to the current elm-lang.org/examples hello-html is now written as

 import Html exposing (text) main = text "Hello!" 
+5
source share

All Articles