elm-lang / elm-package

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

no error thrown on inexistent version but block normal usage of elm make #275

Open Grummfy opened 7 years ago

Grummfy commented 7 years ago

Hello, I see a package and try to install it through some change in elm-package.json but I add a version that doesn't exist.

So because of no error are displayed when you make a "elm make" or "elm package install", I just got error on elm make but like if the elm-stuff directory was corrupted. It take me a long time to understand it.

So I propose when a version doesn't exist, the issue should be a clear message and not something that create confusion.

process-bot commented 7 years ago

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

jerith666 commented 6 years ago

I just hit this as well. A bit more detail:

I had "rtfeldman/elm-css": "13.0.1 <= v < 14.0.0" in my elm-package.json. I wanted to update to 14.x, so I did:

$ elm-package install rtfeldman/elm-css
Error: This change is too tricky for me. Your elm-package.json already lists the
following dependency:

    "rtfeldman/elm-css": "13.0.1 <= v < 14.0.0"

So I am not sure how to make that include version 14.0.0 as well. Maybe you want
one of the following constraints?

    13.0.1 <= v < 14.0.0
    14.0.0 <= v < 15.0.0

Modify elm-package.json by hand to be exactly what you want.

Not paying close attention -- in particular, not noticing that my lower bound was at 13.0.1 instead of 13.0.0 -- I just went in and changed the 13 to a 14 (as in https://github.com/jerith666/elbum/commit/7b8e3250af43a45c69cf8557d836a1b595b153e6). This left elm-package.json referring to a non-existent version of elm-css, 14.0.1. Then elm-make wouldn't work, it got into an infinite loop of telling me to delete elm-stuff:

$ elm-make --output elbum.js Main.elm 
Packages configured successfully!
Could not find package elm-lang/dom.

Maybe your elm-stuff/ directory has been corrupted? You can usually fix stuff
like this by deleting elm-stuff/ and rebuilding your project.

$ rm -rf elm-stuff

$ elm-make --output elbum.js Main.elm 
Packages configured successfully!
Could not find package elm-lang/dom.

Maybe your elm-stuff/ directory has been corrupted? You can usually fix stuff
like this by deleting elm-stuff/ and rebuilding your project.

$ ls -lR elm-stuff
elm-stuff:
total 8
-rw-r--r-- 1 matt users    2 May  6 21:43 exact-dependencies.json
drwxr-xr-x 2 matt users 4096 May  6 21:43 packages

elm-stuff/packages:
total 0

$ cat elm-stuff/exact-dependencies.json 
{}

The above was with:

$ elm-make --version
Invalid option `--version'

elm-make 0.18 (Elm Platform 0.18.0)