Description
When running the Elm compiler without the ELM_HOME environment variable set, it defaults to using the the location of elm im assuming for storing data. In certain environments, the process may lack the necessary permissions to write to this directory, resulting in a Permission Denied error.
This issue stems from the getElmHome function within the Stuff module in the Elm compiler source code. Below is the relevant snippet from the Stuff module:
getElmHome :: IO FilePath
getElmHome =
do maybeCustomHome <- Env.lookupEnv "ELM_HOME"
case maybeCustomHome of
Just customHome -> return customHome
Nothing -> Dir.getAppUserDataDirectory "elm"
In the absence of the ELM_HOME environment variable, getElmHome defaults to using AppUserDataDirectory.
Steps to Reproduce
- Ensure the
ELM_HOME environment variable is not set.
- Run the Elm compiler command in an environment where the
AppUserDataDirectory is not writable by the process.
- Observe the
Permission Denied error.