How To Get Around Elm Make Error On `getAppUserDataDirectory`?

I am trying to use the elm executable release to compile an elm app to javascript.

I am using the elm.exe contained in

To compile an elm app, I start the elm executable with a .net c# program like this:

var process = new System.Diagnostics.Process
    StartInfo = new ProcessStartInfo
        WorkingDirectory = workingDirectory,
        FileName = executableFilePath,
        Arguments = "make CounterWebApp.elm --output=\"file-for-elm-make-output.js\"",
        UseShellExecute = false,
        RedirectStandardOutput = true,
        RedirectStandardError = true,

var standardOutput = process.StandardOutput.ReadToEnd();
var standardError = process.StandardError.ReadToEnd();

var exitCode = process.ExitCode;

This works on a development machine, but when I use this approach on an azure app, elm make fails with following output:

  • Exit Code: 1
  • Standard Output: contains 0 characters
  • Standard Error: elm.exe: getAppUserDataDirectory:sHGetFolderPath: illegal operation (unsupported operation)

How do I use elm make without dependency on getAppUserDataDirectory?

How can I configure my system so that elm make works?

I am not familiar with the internals of the elm compiler, I guess that the dependency is used for caching on the default file system.
I ran elm make --help to see if I can use an argument to avoid this, but only get this:

The `make` command compiles Elm code into JS or HTML:

    elm19 make <zero-or-more-elm-files>

For example:

    elm make src/Main.elm

This tries to compile an Elm file named src/Main.elm, putting the resulting
JavaScript code in an elm.js file.

You can customize this command with the following flags:

        Turn on the time-travelling debugger. It allows you to rewind and replay
        events. The events can be imported/exported into a file, which makes for
        very precise bug reports!

        Turn on optimizations to make code smaller and faster. For example, the
        compiler renames record fields to be as short as possible and unboxes
        values to reduce allocation.

        Specify the name of the resulting JS file. For example
        --output=assets/elm.js to generate the JS at assets/elm.js or
        --output=/dev/null to generate no output at all!

        You can say --report=json to get error messages as JSON. This is only
        really useful if you are an editor plugin. Humans should avoid it!

        Generate a JSON file of documentation for a package. Eventually it will
        be possible to preview docs with `reactor` because it is quite hard to
        deal with these JSON files directly.

In other thread it was mentioned that you can set home directory with ELM_HOME.


Awesome, setting ELM_HOME seems to solve the problem:

var elmHomeDirectory = Path.Combine(workingDirectory, "elm-make-home-directory");
process.StartInfo.Environment["ELM_HOME"] = elmHomeDirectory;

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.