elm-lang / elm-package

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

Strange errors for invalid version bounds #250

Closed colinmccabe closed 7 years ago

colinmccabe commented 7 years ago

Possibly related to #249

Running elm package install on a clean project containing only an elm-package.json with invalid version bounds "elm-lang/html": "2.0.0 <= v < 2.0.0"

{
    "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.0.0 <= v < 6.0.0",
        "elm-lang/html": "2.0.0 <= v < 2.0.0"
    },
    "elm-version": "0.18.0 <= v < 0.19.0"
}

results in

elm-package: elm-stuff/exact-dependencies.json: openBinaryFile: does not exist (No such file or directory)

Creating an empty elm-stuff and running elm package install again prints only Packages configured successfully!, and creates empty elm-stuff/exact-dependencies.json and elm-stuff/packages.

Using Elm 0.18 Beta for Mac from this revision of the Gist: https://gist.github.com/evancz/8032a3ac6eb7a4ac8e0956ed6d386798/7f5775901120d24726e6610e8065aea5b17643da

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.

zgotsch commented 7 years ago

Related (enough that I didn't want to make a new issue):

I noticed when I accidentally provided invalid version bounds "elm-community/html-extra": "2.2.0 <= v < 2.0.0" that instead of erroring, elm package install tried to remove all of the installed packages:

Some new packages are needed. Here is the upgrade plan.

  Remove:
    elm-lang/core
    elm-lang/html
    elm-lang/virtual-dom
    elm-lang/websocket

Do you approve of this plan? [Y/n] n

When adjusted to the correct bounds ("elm-community/html-extra": "2.2.0 <= v < 3.0.0"), the installation proceeds as expected:

> elm package install
Some new packages are needed. Here is the upgrade plan.

  Install:
    elm-community/html-extra 2.2.0

Do you approve of this plan? [Y/n] y
evancz commented 7 years ago

Added some new code that will disallow invalid bounds with nicer error messages. Thanks for the report!