stack new command failing to download build plan for lts-14.1
The error message is confusing because it doesn't say anything about the cause of the 404 error. It might be due to a wrong version of Stack. To check this, type:
stack --version
Not only this command will tell you which version is installed, but it will also tell you what is the most up to date version. If your version is not the most up to date, and moreover if your version is an "unsupported" one, it might display a message such as
Warning: this is an unsupported build that may use different versions of
dependencies and GHC than the officially released binaries, and therefore may
not behave identically. If you encounter problems, please try the latest
official build by running 'stack upgrade --force-download'.
Just do as indicated and you should be OK:
stack upgrade --force-download
You might get a message saying that there had been an error while copying to /usr/bin, and asking if you want to retry with sudo
. Just accept and enter you sudo
password.
Check that the new upgraded version is now up to date by typing:
stack -version
To answer my own question:
Turns out I was using an old version of stack
. After upgrading via
stack upgrade
everything works as expected.