dillonkearns / elm-pages

Hybrid Elm framework with full-stack and static routes.
https://elm-pages.com
BSD 3-Clause "New" or "Revised" License
658 stars 97 forks source link

elm-pages build fails due to an unsupported version of elm-review #480

Closed asielorz closed 4 months ago

asielorz commented 5 months ago

I started experiencing this problem at some point this month. On June 1st, my github workflow running elm-pages build worked perfectly. On June 17th I added a new markdown page to my repositiory and the build process failed. I made no changes to source code or build configuration. I had my elm-pages version pinned to 3.0.8.

npx elm-pages@3.0.8 build
npm warn exec The following package was not found and will be installed: elm-pages@3.0.8
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated rimraf@2.7.1: Rimraf versions prior to v4 are no longer supported
(node:1857) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
No `elm-pages.config.mjs` file found. Using default config.
vite v4.5.3 building for production...
transforming...
✓ 5 modules transformed.
rendering chunks...
computing gzip size...
dist/manifest.json                   0.33 kB │ gzip: 0.16 kB
dist/elm-stuff/elm-pages/index.html  0.60 kB │ gzip: 0.36 kB
dist/assets/index-21fb42a2.css       0.12 kB │ gzip: 0.13 kB
dist/assets/index-e92a2e56.js        2.39 kB kB │ gzip: 1.22 kB
✓ built in 187ms
Trace: {"type":"error","title":"UNSUPPORTED ELM-REVIEW VERSION","path":"/home/runner/.npm/_npx/24526b09e934adc2/node_modules/elm-pages/generator/dead-code-review/elm.json","message":["You are using an unsupported version of the jfmengels/elm-review Elm package.\nYou are using version 2.13.0, but I need it to be 2.14.0 <= v < 3.0.0.\n\nPlease upgrade your version by running the following commands:\n\ncd /home/runner/.npm/_npx/24526b0e934adc2/node_modules/elm-pages/generator/dead-code-review\nnpx elm-json install jfmengels/elm-review@2\n\nIf that doesn't work, try out:\n\ncd /home/runner/.npm/_npx/24526b09e934adc2/node_modules/elm-pages/generator/dead-code-review\nnpx elm-json upgrade --unsafe"]}
    at Module.run (file:///home/runner/.npm/_npx/24526b09e934adc2/node_modules/elm-pages/generator/src/build.js:293:13))
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Command.<anonymous> (file:///home/runner/.npm/_npx/24526b09e934adc2/node_modules/elm-pages/generator/src/cli.js:49:7)
-- UNSUPPORTED ELM REVIEW VERSION --------------- /home/runner/.npm/_npx/24526b09e934adc2/node_modules/elm-pages/generator/dead-code-review/elm.json
You are using an unsupported version of the jfmengels/elm-review Elm package.
You are using version 2.13.0, but I need it to be 2.14.0 <= v < 3.0.0.
Please upgrade your version by running the following commands:
cd /home/runner/.npm/_npx/24526b09e934adc2/node_modules/elm-pages/generator/dead-code-review
npx elm-json install jfmengels/elm-review@2
If that doesn't work, try out:
cd /home/runner/.npm/_npx/24526b09e934adc2/node_modules/elm-pages/generator/dead-code-review
npx elm-json upgrade --unsafe

I have tried upgrading all dependencies. I am now using elm-pages 3.0.15. I have upgraded all versions of dependencies in my elm.json file. My elm-json file explicitly depends on jfmengels/elm-review 2.14.0, and I am still getting the same error.

I have also tried the solutions proposed by the script. npx elm-json install jfmengels/elm-review@2 and npx elm-json upgrade --unsafe.

npx elm-pages@3.0.15 build
npm warn exec The following package was not found and will be installed: elm-pages@3.0.15
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated rimraf@2.7.1: Rimraf versions prior to v4 are no longer supported
(node:1852) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
No `elm-pages.config.mjs` file found. Using default config.
vite v5.3.1 building for production...
transforming...
✓ 5 modules transformed.
rendering chunks...
computing gzip size...
dist/___vite-manifest___.json        0.23 kB │ gzip: 0.16 kB
dist/elm-stuff/elm-pages/index.html  0.60 kB │ gzip: 0.36 kB
dist/assets/index-BVZlNRUH.css       0.12 kB │ gzip: 0.13 kB
dist/assets/index-Dxz7Rhaw.js        2.39 kB │ gzip: 1.23 kB
✓ built in 195ms
Trace: {"type":"error","title":"UNSUPPORTED ELM-REVIEW VERSION","path":"/home/runner/.npm/_npx/6eca888154b357e8/node_modules/elm-pages/generator/dead-code-review/elm.json","message":["You are using an unsupported version of the jfmengels/elm-review Elm package.\nYou are using version 2.13.1, but I need it to be 2.14.0 <= v < 3.0.0.\n\nPlease upgrade your version by running the following commands:\n\ncd /home/runner/.npm/_npx/6eca888154b357e8/node_modules/elm-pages/generator/dead-code-review\nnpx elm-json install jfmengels/elm-review@2\n\nIf that doesn't work, try out:\n\ncd /home/runner/.npm/_npx/6eca888154b357e8/node_modules/elm-pages/generator/dead-code-review\nnpx elm-json upgrade --unsafe"]}
    at Module.run (file:///home/runner/.npm/_npx/6eca888154b357e8/node_modules/elm-pages/generator/src/build.js:295:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Command.<anonymous> (file:///home/runner/.npm/_npx/6eca888154b357e8/node_modules/elm-pages/generator/src/cli.js:49:7)
-- UNSUPPORTED ELM REVIEW VERSION --------------- /home/runner/.npm/_npx/6eca888154b357e8/node_modules/elm-pages/generator/dead-code-review/elm.json
You are using an unsupported version of the jfmengels/elm-review Elm package.
You are using version 2.13.1, but I need it to be 2.14.0 <= v < 3.0.0.
Please upgrade your version by running the following commands:
cd /home/runner/.npm/_npx/6eca888154b357e8/node_modules/elm-pages/generator/dead-code-review
npx elm-json install jfmengels/elm-review@2
If that doesn't work, try out:
cd /home/runner/.npm/_npx/6eca888154b357e8/node_modules/elm-pages/generator/dead-code-review
npx elm-json upgrade --unsafe
Error: Process completed with exit code 1.

First of all, it looks like the build process is not hermetic and even when pinning versions it can spuriously break without changing any code or build configuration.

Second, I don't understand why the build is deciding to use elm-review 2.13.1 when elm.json explicitly states that it depends on elm-review 2.14.0. I am not sure if this is an elm-pages bug or a bug in any of the layers below like lamdera or the elm-compiler.

Just in case, the entire elm.json file

{
    "type": "application",
    "source-directories": [
        "src",
        "app",
        ".elm-pages"
    ],
    "elm-version": "0.19.1",
    "dependencies": {
        "direct": {
            "danfishgold/base64-bytes": "1.1.0",
            "danyx23/elm-mimetype": "4.0.1",
            "dillonkearns/elm-bcp47-language-tag": "2.0.0",
            "dillonkearns/elm-form": "3.0.0",
            "dillonkearns/elm-markdown": "7.0.1",
            "dillonkearns/elm-pages": "10.1.0",
            "elm/browser": "1.0.2",
            "elm/bytes": "1.0.8",
            "elm/core": "1.0.5",
            "elm/html": "1.0.0",
            "elm/http": "2.0.0",
            "elm/json": "1.1.3",
            "elm/parser": "1.1.0",
            "elm/random": "1.0.0",
            "elm/regex": "1.0.0",
            "elm/time": "1.0.0",
            "elm/url": "1.0.0",
            "elm/virtual-dom": "1.0.3",
            "elm-community/dict-extra": "2.4.0",
            "elm-community/list-extra": "8.7.0",
            "elm-community/result-extra": "2.4.0",
            "jfmengels/elm-review": "2.14.0",
            "jluckyiv/elm-utc-date-strings": "1.0.0",
            "jmpavlick/elm-ui-markdown": "1.0.0",
            "justinmimbs/date": "4.1.0",
            "mdgriffith/elm-codegen": "4.2.2",
            "mdgriffith/elm-ui": "1.1.8",
            "miniBill/elm-codec": "2.1.0",
            "noahzgordon/elm-color-extra": "1.0.2",
            "robinheghan/fnv1a": "1.0.0",
            "rtfeldman/elm-css": "18.0.0",
            "the-sett/elm-syntax-dsl": "6.0.2",
            "turboMaCk/non-empty-list-alias": "1.4.0",
            "vito/elm-ansi": "10.0.1"
        },
        "indirect": {
            "Chadtech/elm-bool-extra": "2.4.2",
            "avh4/elm-color": "1.0.0",
            "dillonkearns/elm-cli-options-parser": "3.2.0",
            "dillonkearns/elm-date-or-date-time": "2.0.0",
            "elm/file": "1.0.5",
            "elm/project-metadata-utils": "1.0.2",
            "elm-community/basics-extra": "4.1.0",
            "elm-community/maybe-extra": "5.3.0",
            "elm-explorations/test": "2.2.0",
            "fredcy/elm-parseint": "2.0.1",
            "miniBill/elm-unicode": "1.1.1",
            "robinheghan/murmur3": "1.0.0",
            "rtfeldman/elm-hex": "1.0.0",
            "rtfeldman/elm-iso8601-date-strings": "1.1.4",
            "stil4m/elm-syntax": "7.3.2",
            "stil4m/structured-writer": "1.0.3",
            "the-sett/elm-pretty-printer": "3.1.0"
        }
    },
    "test-dependencies": {
        "direct": {},
        "indirect": {}
    }
}
dillonkearns commented 5 months ago

Hello @asielorz, I believe what is happening here is that elm-pages runs elm-review for some internal checks to help give improved error messages to the user, but there was a recent upgraded elm-review NPM package. So the internal elm-review code for elm-pages needs to update to the latest elm-review Elm package to be compatible if you are using the latest version of the CLI tool in your package.json. I'm on vacation at the moment, but when I'm back I'll push out an update for that.

You can downgrade to an earlier elm-review NPM package in your package.json to get it running as a workaround.

asielorz commented 5 months ago

Pinning elm-review version to 2.11.2 fixed the problem. Thanks so much for the help. I love elm-pages by the way. Great work!

dillonkearns commented 4 months ago

Published NPM package elm-pages@3.0.16 which uses the latest elm-review for the internal elm-review rules, allowing users to use the latest elm-review NPM package in their project's package.json 👍