How To Install A Package From

I tried the approach from to install packages into my elm app. This worked for some packages.
But there is also this package
I did not get the Windows Elm binary to add this package to the project.
The output from Elm follows:

elm19 install mpizenberg/elm-pointer-events
-- HTTP PROBLEM ----------------------------------------------------------------

The following HTTP request failed:


Here is the error message I was able to extract:

    HttpExceptionRequest Request { host = "" port = 443
    secure = True requestHeaders =
    [("User-Agent","elm/0.19.0"),("Accept-Encoding","gzip")] path =
    "/packages/mpizenberg/elm-pointer-events/4.0.0/elm.json" queryString = ""
    method = "GET" proxy = Nothing rawBody = False redirectCount = 10
    responseTimeout = ResponseTimeoutDefault requestVersion = HTTP/1.1 }
    (StatusCodeException (Response {responseStatus = Status {statusCode = 404,
    statusMessage = "Not Found"}, responseVersion = HTTP/1.1, responseHeaders =
    [("Server","nginx/1.10.3 (Ubuntu)"),("Date","Tue, 04 Dec 2018 11:11:11
    responseBody = (), responseCookieJar = CJ {expose = []}, responseClose' =
    ResponseClose}) "<!DOCTYPE HTML>\n<html>\n<head>\n <meta
    charset=\"UTF-8\">\n <link rel=\"shortcut icon\" size=\"16x16, 32x32, 48x48,
    64x64, 128x128, 256x256\" href=\"/assets/favicon.ico\">\n <title>Not
    Found</title>\n <link rel=\"stylesheet\"
    href=\"/assets/highlight/styles/default.css?1538874483\">\n <link
    rel=\"stylesheet\" href=\"/assets/style.css?1538874483\">\n <script
    src=\"/assets/highlight/highlight.pack.js?1538874483\"></script>\n <script

When I use a known wrong package name, the error message looks different:

elm19 install mpizenberg/elm-pointer-events123456789
-- PACKAGE NOT FOUND -----------------------------------------------------------

I cannot find a mpizenberg/elm-pointer-events123456789 package on the package

Maybe you want one of these instead?


But check <> to see all possibilities!

One idea I had was to specify the version of the package that I want, in this case 3.1.0.
How could I do this? From the help option, I only get this:

elm19 install --help
The `install` command fetches packages from <> for
use in your project:

    elm19.exe install
    elm19.exe install <package>

For example, if you want to get packages for HTTP and JSON, you would say:

    elm install elm/http
    elm install elm/json

Notice that you must say the AUTHOR name and PROJECT name! After running those
commands, you could say `import Http` or `import Json.Decode` in your code.

What if two projects use different versions of the same package? No problem!
Each project is independent, so there cannot be conflicts like that!

Maybe I can specify the version by using the path analogous to how it is shown on the package website?
Looks like this does not work either:

elm19 install mpizenberg/elm-pointer-events/3.1.0
elm19.exe: TODO show possible arg configurations
CallStack (from HasCallStack):
  error, called at ui/terminal/src\Terminal\Args\Error.hs:281:13 in main:Terminal.Args.Error

It seems like elm is trying to install version 4.0.0 which doesn’t exist? You could try deleting elm-stuff and checking if there is 4.0.0 cached at ~/.elm/0.19.0/package/mpizenberg/elm-pointer-events and if there is, delete it. (EDIT: That is path for Linux, I don’t know where that cache is in Windows.)

To install specific version, you would need to edit elm.json manually, adding "mpizenberg/elm-pointer-events": "3.1.0" to direct packages, and any packages it needs to indirect packages.

1 Like

Problems like this can happen if package author releases a version, which is then removed, and Elm gets confused about what really is the latest version. And it seems that there has at least been some experimenting with version 4.0.0 of that package: Bump rc1 to 4.0.0

Thank you for the pointers.
The first one I tried was to delete elm-stuff. This did not make a differece.

There is actually an empty directory at %AppData%\elm\0.19.0\package\mpizenberg\elm-pointer-events\4.0.0

I deleted %AppData%\elm\0.19.0\package\mpizenberg\elm-pointer-events. But after I run elm19 install mpizenberg/elm-pointer-events again, the %AppData%\elm\0.19.0\package\mpizenberg\elm-pointer-events\4.0.0 is there again.

Package versions seems to be cached at ...\0.19.0\package\versions.dat - try deleting that, or even all of ...\0.19.0\package.

1 Like

Deleting %AppData%\elm\0.19.0\package\versions.dat solved the problem.

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