avh4 / elm-upgrade

Upgrade Elm projects

Home Page:https://www.npmjs.com/package/elm-upgrade

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"versions" no longer exists in https://package.elm-lang.org/search.json

hpate-omicron opened this issue · comments

commented

This came from slack - https://elmlang.slack.com/archives/C0CJ3SBBM/p1582057782068800

When the code tries to call supportedPackages[packageInfo.name] = packageInfo.versions.slice(-1)[0]; it ends up with an error (node:19118) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'slice' of undefined because the versions property no longer exists in the search.json from the package repo.

Code with slice:

supportedPackages[packageInfo.name] = packageInfo.versions.slice(-1)[0];

Search.json: https://package.elm-lang.org/search.json

It looks like this commit on the package repo changed it - elm/package.elm-lang.org@ad9e889

I just ran into the same issue. After doing an npm install -g elm-format and changing the offending line to supportedPackages[packageInfo.name] = packageInfo.version;, I could successfully run elm-upgrade. It looks like elm-ugrade only wants to know whether a given package exists, not which versions it has.

Fixed in 0.19.8