Jeff Jeff - 18 days ago 5x
Markdown Question

How to use de elm-markdown module in Elm?

I am completely new to Elm, and I am going through the examples to get acquainted with the language. The problem is that I can not run the markdown example.

The code is as follows:

import Markdown

main = Markdown.toHtml [] markdown

markdown = """

# This is Markdown

[Markdown]( lets you
write content in a really natural way.

* You can have lists, like this one
* Make things **bold** or *italic*
* Embed snippets of `code`
* Create [links](/)
* ...

The [elm-markdown][] package parses all this content, allowing you
to easily generate blocks of `Element` or `Html`.



But when I try to compile it I get the following message:

I cannot find module 'Markdown'.

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

I have already installed the module with the command

$ elm-package install evancz/elm-markdown

Any explanation of what is happening and how to fix it will be greatly appreciated. Thanks in advance.


Make sure to run the elm package install command in the same directory where you are trying to build the code. To verify, you can look to see that there is an elm-stuff directory.

Package installations are local to the project itself. They aren't system wide, so if you start a new project, you'll have to run elm package install in that directory too.

In rare circumstances I've also seen that error message occur even though the package is installed. While I can't determine what caused the problem, deleting the elm-stuff and running just elm package install (no other arguments) from the project root fixes the problem.