elm-lang/elm-platform

Error Installing The Elm HTTP Library For Elm 0.17

conradwt opened this issue · 10 comments

I’m getting the following error when I attempt to elm-package install -y:

Error: Your .elm/packages/ directory may be corrupted. I was led to beleive that
elm-lang/elm-http existed, but I could not find anything when I went to look up
the published versions of this package.

Thus, I deleted the ~/.elm directory and tried the command again without success. BTW, the directory tree looks as follows:

.elm
└── 0.17.1
    └── package
        ├── last-updated
        └── versions.dat

It's not clear as to where this library is located bacause I have tried all of the following without success:

$ elm-package install evancz/elm-http 3.0.1
$ elm-package install elm-lang/http 3.0.1
$ elm-package install elm-lang/elm-http 3.0.1

Can you show your elm-package.json? Did you add entries by hand?

Also, I'd recommend using the 0.17.1 release because it has nicer error messages when you try to install something with an unknown name.

@evancz Yes, I'm using Elm 0.17.1. Next, I tried adding the entries using elm package install package-name as well as manually within elm-package.json. Next, here's the actual file:

{
    "version": "1.0.0",
    "summary": "helpful summary of your project, less than 80 characters",
    "repository": "https://github.com/user/project.git",
    "license": "BSD3",
    "source-directories": [
        "."
    ],
    "exposed-modules": [],
    "dependencies": {
        "elm-lang/core": "4.0.1 <= v < 5.0.0",
        "elm-lang/html": "1.1.0 <= v < 2.0.0",
        "evancz/elm-http": "3.0.1 <= v < 4.0.0"
    },
    "elm-version": "0.17.1 <= v < 0.18.0"
}

@evancz elm package install package-name will generate another elm-package.json within the root of a Phoenix project instead of honoring the configuration in the brunch-config.js. Now, the current state of the elm-package.json looks as follows because 0.17.1 introduced some breaking changes which caused the creation of a Task.Extra library in order to migrate from 0.16 to 0.17.1:

{
    "version": "1.0.0",
    "summary": "helpful summary of your project, less than 80 characters",
    "repository": "https://github.com/user/project.git",
    "license": "BSD3",
    "source-directories": [
        "."
    ],
    "exposed-modules": [],
    "dependencies": {
        "elm-lang/core": "4.0.1 <= v < 5.0.0",
        "elm-lang/html": "1.1.0 <= v < 2.0.0",
        "evancz/elm-http": "3.0.1 <= v < 4.0.0",
        "NoRedInk/elm-task-extra": "2.0.0 <= v < 3.0.0"
    },
    "elm-version": "0.17.1 <= v < 0.18.0"
}

I plan to move the elm-package.json to the root of the Phoenix project to eliminate the creation of this duplicate file.

zkvn commented

I met the same issue when I was following the tutorial on HTTP.

I recently started to play with Elm and installed 0.17.1 from beginning. When I run the tutorial it gave me below error messages:

I cannot find module 'Http'.

Module 'Main' is trying to import it.

Potential problems could be:
  * Misspelled the module name
  * Need to add a source directory or new dependency to elm-package.json

To fix it, I tried "elm-package install evancz/elm-http", but it didn't work. When I tried the same command again, it said

Error: Your .elm/packages/ directory may be corrupted. I was led to believe that
elm-lang/http existed, but I could not find anything when I went to look up the
published versions of this package.

---UPDATE---
The problem was mysteriously resolved after I removed and reinstalled everything. One of the possible reasons I could guess is that when I first installed the HTTP package, "elm reactor" was running on the background. Guess that may have caused some files to be corrupted?

I had this issue too, when I was following the tutorial at https://guide.elm-lang.org/architecture/effects/http.html .

I did have the elm-http installed where my http example is located, but elm-reactor keeps saying the same error. It turned out that I was running elm-reactor in the outer or parent directory, where elm-http is not installed. This was resolved by either installing elm-http in the parent directory of my http example and re-run elm-reactor from there, or run elm-reactor where the http-example is. I hope this makes sense.

Tldr, if you use elm-reactor, ensure you have all the required packages installed in the directory where you are going to run elm-reactor. Well, in my case, thats how it was resolved.

I'm running elm-package install elm-lang/http 3.0.1 but no luck so far.
My elm-stuff/packages directory is completely empty.

Has anyone faced this issue?

@snowcrshd Since evancz/elm-http been migrated as elm-lang/http, it's current version also been bumped back to 1.0.0, and the compatible elm version is bumped to 0.18.0. Thus, although this thread is about elm 0.17, I think you will need to upgrade your elm if you want to use the latest elm-lang/http package. Once you having the latest elm, could you try either:

  1. Run elm package install elm-lang/http 1.0.0
  2. Put "elm-lang/http": "1.0.0 <= v < 2.0.0" in the dependencies section, nuke the elm-stuff directory, and run elm package install or just elm make your project?

I have the same issue with packages like "gdotdesign/elm-ui" or "gdotdesign/elm-storage".
I'm using elm 0.18. Is elm package installer installs only from official elm package index? All internal packages must be downloaded by ourselves and added to "src" ?

i have elm 0.18.0 installed and tried to install elm-lang/http package but gives the following error:

You are using Elm 0.18.0, but this project is saying it needs a version
in this range: 0.17.0 <= v < 0.18.0

so apparently everything is properly set yet still gives an error. btw elm 0.17.0 also gives an error saying it can't find elm-lang/http package

it turns out i was using an outdated elm-package.json configured for elm 0.17.0, so after deleting it i was able to run elm-make from scratch that automatically produced an updated elm-package.json for my dependencies and platform