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

Initialization failed while loading node modules #450

Closed DavidDTA closed 10 months ago

DavidDTA commented 10 months ago

Following the instructions in the Getting Started section of the docs, I ran npx elm-pages init my-project, and it failed with the following error:

$ npx elm-pages init my-project
file:///home/dta/.npm/_npx/f522c3e74dfcf71b/node_modules/globby/index.js:27
    const extensionGlob = extensions?.length > 0 ? `.${extensions.length > 1 ? `{${extensions.join(',')}}` : extensions[0]}` : '';
                                     ^

SyntaxError: Unexpected token '.'
    at Loader.moduleStrategy (internal/modules/esm/translators.js:133:18)

I am not an expert in node/npm, but it looks like it's not correctly interpreting the syntax of one of the packages used in the package loader.

Here are some diagnostics. Let me know if anything else would be relevant.

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.3 LTS
Release:    22.04
Codename:   jammy
$ node --version
v12.22.9
$ npx --version
8.5.1
DavidDTA commented 10 months ago

It looks like the most recent version of node available via the ubuntu package manager on 22.0.4 may be quite old, and I expect that may be it. I'll try re-installing node with nvm to see if I can get a more recent version.

It might be worth specifying the npm/node version requirements in the getting started guide.

dillonkearns commented 10 months ago

Yeah, even Node 16 is already end of life. Basically the intention is to support whatever the Node EOL schedule is: https://nodejs.org/en/about/previous-releases.

I would welcome a PR to add something about that to the docs somewhere.

DavidDTA commented 10 months ago

I had made the apparently erroneous assumption that the LTS version of Ubuntu would provide the LTS version of node. Using node 20.11.0 via nvm seems to have worked.

dillonkearns commented 10 months ago

Yeah, that is surprising that it's such an outdated one.