Closed thewoolleyman closed 7 years ago
@eeue56 Hi, thanks for the comment and reference. Unfortunately, I don't think #246 fixes this specific issue. It recreates the directory if it's missing, but doesn't cause elm-package install
to reinstall missing packages which may have been deleted.
I built from the latest source on master, and was still able to reproduce the problem:
# using fix from #246:
○ → cat /Users/woolley/workspace/elm-package/src/Install.hs | grep 'ensure we have the stuff directory'
-- ensure we have the stuff directory before doing anything else
○ → /Users/woolley/workspace/elm-package/dist/build/elm-package/elm-package
elm-package 0.18.0
# remove packages dir:
○ → rm -rf elm-stuff/packages/
# get same message as before:
○ → /Users/woolley/workspace/elm-package/dist/build/elm-package/elm-package install
Packages configured successfully!
# yet nothing was installed, as before:
○ → ls elm-stuff/packages
# and problem still, obviously, occurs because no packages exist:
○ → elm-make Hello.elm
elm-make: elm-stuff/packages/elm-lang/core/5.0.0/elm-package.json: openBinaryFile: does not exist (No such file or directory)
In 0.19 an application will have all of the exact dependencies listed in the elm.json
file, so there will be no separate exact-dependencies.json
file that you must check in and treat as a lock file.
The intent of elm-stuff/
is that it is managed entirely by Elm, so messing with it is basically corrupting that state. By moving the "lock file" information into elm.json
I believe there will be no reason to partially delete elm-stuff/
, thereby resolving the root issue here.
Based on that understanding, I will close.
I can provide an SSCCE if desired, but the subject should be self explanatory.
This is related to, and a prerequisite for, https://github.com/elm-lang/elm-package/issues/217
The context of this issue is the overall goal of being able to commit
exact-dependencies.json
to source control, so it has a preserved, revertable history of all changes to it. I ran into this issue in my first attempts to use Elm, because I'm in the habit of always committing the full dependency graph of my projects to source control (e.g. Gemfile.lock, npm-shrinkwrap.json).Here's simple steps to reproduce:
elm-stuff/packages
andelm-stuff/build-artifacts
to.gitignore
(thus allowingelm-stuff/exact-dependencies.json
to be committed)elm-stuff/packages
to be deleted (e.g. viagit clean -df
)elm-package install
will do nothing (i.e. leave the packages dir empty).elm-make
to fail with an error like this (obviously, because the core packages do not exist):In looking at the source code briefly, I think I see the problem.
It's because the existence of an
exact-dependencies.json
in Install.hs is assumed to imply that the required packages do not need to be installed, based on a simple diff of old and new in Plan.hs.The simple solution seems to be to make the Plan check for the actual existence of all of the required packages' files, and force a re-install of them if they are missing.