elm-lang / elm-make

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

Unhelpful error if elm-stuff exists but elm-package.json doesn't #171

Open avh4 opened 7 years ago

avh4 commented 7 years ago

Running elm-make in a folder without an elm-package.json normally creates an elm-package.json for you. However, if an elm-stuff folder already exists, it instead gives an unhelpful error message: elm-make: elm-package.json: openBinaryFile: does not exist (No such file or directory)

I would proposed that elm-make should behave the same regarding the existence of elm-package.json regardless of whether elm-stuff exists. Alternatively, a more helpful message (something like "There is no elm-package.json file. If you want elm-make to create one for you, first delete the elm-stuff folder.")

To reproduce:

elm-make --yes
rm elm-package.json
elm-make
--> elm-make: elm-package.json: openBinaryFile: does not exist (No such file or directory)
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.

sashaafm commented 6 years ago

Bump.

This also seems to happen when elm-stuff exists with exact-dependencies.json inside. Besides the error message not being helpful at all, this does not fit my current use-case of versioning exact-dependencies.json, to always download the exact same version of a package.

If there's another way to achieve this use-case please tell me, as I couldn't find how to always download the same package down to the PATCH level.

EDIT: As a workaround it seems to be needed to delete the whole elm-stuff directory, which also deletes exact-dependencies.json. Then upon rebuilding one must hope the downloaded packages will match the ones in the versioned exact-dependencies.json, which is less than ideal.

zwilias commented 6 years ago

You can manually add all the dependencies as found in exact-dependencies.json file to elm-package.json and restrict the version range to only allow a single version, e.g. 1.2.3 <= v < 1.2.4. The only version that could ever satisfy that constraint is 1.2.3 itself.