elm-lang / elm-make

A build tool for Elm projects
BSD 3-Clause "New" or "Revised" License
175 stars 45 forks source link

bad error when bad constraint is added by hand #117

Open martindemello opened 8 years ago

martindemello commented 8 years ago

elm version: 0.17

I added "elm-lang/keyboard": "1.1.0 <= v < 2.0.0" to my elm-package.json (should have been 1.0.0, since that's the latest available version) and ran elm-make. It failed with

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

which is technically correct, but doesn't really explain the problem.

process-bot commented 8 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.

evancz commented 8 years ago

Can you give more information about your setup? What is the content of your elm-package.json? How did you add this line? How did you set up your project?

From the message, it looks like you got your project into a weird configuration with the steps you took to get there.

martindemello commented 8 years ago

I had an existing project that I wanted to add keyboard support to, so I added "elm-lang/keyboard": "1.1.0 <= v < 2.0.0" to my elm-package.json, blew away elm-stuff/, and ran elm-make. (I added it manually by copy/pasting the line for elm-lang/svg, which is how I ended up with 1.1.0).

Easy way to reproduce: Add this file to a clean directory

{
  "version": "1.0.0",
  "summary": "let people do a cool thing in a fun way",
  "repository": "https://github.com/user/project.git",
  "license": "BSD3",
  "source-directories": [
      "."
  ],
  "exposed-modules": [],
  "dependencies": {
    "elm-lang/core": "4.0.0 <= v < 5.0.0",
    "elm-lang/html": "1.0.0 <= v < 2.0.0",
    "elm-lang/keyboard": "1.1.0 <= v < 2.0.0"
  },
  "elm-version": "0.17.0 <= v < 0.18.0"
}

run elm-make (which will fail with the error message about elm-stuff/exact-dependencies.json not existing)

Now edit the last line of the dependencies to read

    "elm-lang/keyboard": "1.0.0 <= v < 2.0.0"

and run elm-make again, which will succeed.

It should fail with a helpful error message when it fails to generate elm-stuff/exact-dependencies.json , not with a file-not-found when it fails to read it back.

evancz commented 8 years ago

Thanks for the report for when things are added by hand. For now I recommend using commands like elm-package install elm-lang/keyboard to do this!

martindemello commented 8 years ago

ah :) didn't realise that elm-package would do this for me.