elm-lang / elm-package

Command line tool to share Elm libraries
BSD 3-Clause "New" or "Revised" License
214 stars 66 forks source link

Confusing error messages for unpublished dependencies #176

Closed azazdeaz closed 8 years ago

azazdeaz commented 8 years ago

Hi, i just started with elm, so maybe i just messed up something and it's not an error.

After i updated Elm to v0.16 my refreshed my elm-package.json looked like this:

{
    "version": "1.0.0",
    "summary": "helpful summary of your project, less than 80 characters",
    "repository": "https://github.com/azazdeaz/elm-lost-in-migration-game.git",
    "license": "MIT",
    "source-directories": [
        "src"
    ],
    "exposed-modules": [],
    "dependencies": {
        "elm-lang/core": "3.0.0 <= v < 4.0.0",
        "evancz/elm-html": "4.0.2 <= v < 5.0.0",
        "evancz/elm-svg": "2.0.1 <= v < 3.0.0",
        "evancz/start-app": "2.0.2 <= v < 3.0.0",
        "mgold/Elm-Random-Sampling": "2.0.3 <= v < 3.0.0"
    },
    "elm-version": "0.15.0 <= v < 0.17.0"
}

and for elm package install i got this error message

Error: Unable to get elm-package.json for evancz/virtual-dom 1.2.2
Missing field "elm-version", acceptable versions of the Elm Platform (e.g. "0.16.0 <= v < 0.17.0").
    Check out an example elm-package.json file here:
    <https://raw.githubusercontent.com/evancz/elm-html/master/elm-package.json>

but when i removed the evancz/elm-svg dependency from the elm-package.json i got this:

Error: Unable to find a set of packages that will work with your constraints.

Later i figured that mgold/Elm-Random-Sampling was renamed to mgold/elm-random-sample so i changed it and now everything works well but it would be nice to make this error more straight forward.

$ elm make --version
elm-make 0.16 (Elm Platform 0.16.0) 
evancz commented 8 years ago

I believe the changes shown in https://github.com/elm-lang/elm-package/pull/177#issuecomment-222916014 will directly address the "upgrading is hard" scenario that you faced. I cannot recreate your scenario exactly, but the new version would have given you something like:

--> There are no versions of mgold/Elm-Random-Sampling that work with Elm 0.16.0.
    Maybe the maintainer has not upgraded it yet?

Thanks for the report!