elm / error-message-catalog

A catalog of broken Elm programs / data to improve error messages
BSD 3-Clause "New" or "Revised" License
173 stars 17 forks source link

Cannot find module Svg ("elm-lang/virtual-dom" not added automatically) #235

Closed MBing closed 7 years ago

MBing commented 7 years ago

Great work on Elm and all the tools and documentation, it's really well done and pushing functional programming on the frontend in a great way forward. Unfortunately since I am just starting I ran into a problem while trying an online example locally.

When trying to run this example: https://guide.elm-lang.org/architecture/effects/time.html

I ran the elm-package install command and it gave me back the elm-stuff dir & elm-package.json file which looks like this:

{
    "version": "1.0.0",
    "summary": "helpful summary of your project, less than 80 characters",
    "repository": "https://github.com/user/project.git",
    "license": "BSD3",
    "source-directories": [
        "."
    ],
    "exposed-modules": [],
    "dependencies": {
        "elm-lang/core": "5.1.1 <= v < 6.0.0",
        "elm-lang/html": "2.0.0 <= v < 3.0.0"
    },
    "elm-version": "0.18.0 <= v < 0.19.0"
}

When checking the Svg package use here I see that Svg is built on elm-lang/virtual-dom. So I assume this should be added as a dependency as well after running elm-package install. When running elm-reactor and going to my localhost:8000 I get the following error:

elm svg error

I have tried to update the elm-package.json to (which also did not resolve the issue):

{
    "version": "1.0.0",
    "summary": "helpful summary of your project, less than 80 characters",
    "repository": "https://github.com/user/project.git",
    "license": "BSD3",
    "source-directories": [
        "."
    ],
    "exposed-modules": [],
    "dependencies": {
        "elm-lang/core": "5.1.1 <= v < 6.0.0",
        "elm-lang/html": "2.0.0 <= v < 3.0.0",
        "elm-lang/virtual-dom": "2.0.4 <= v < 3.0.0"
    },
    "elm-version": "0.18.0 <= v < 0.19.0"
}

My question here is, what am I doing wrong and what can I do to fix this? Thank you! :)

jinjor commented 7 years ago

Try elm-package install elm-lang/svg.

When checking the Svg package use here I see that Svg is built on elm-lang/virtual-dom.

This means that elm-lang/svg internally uses elm-lang/virtual-dom.

MBing commented 7 years ago

Thank you @jinjor This worked. Next time I guess I have to check the path and that will show me what to install. I was a bit confused by the docs.

Path being elm-lang/svg (/2.0.0) All makes sense now.

Closing this and thanks for the very quick response!