Elm-pages is failing with ERR! code ELIFECYCLE

An elm-pages app that was working ok with ‘npm start’ is now failing with:

…/node_modules/elm-pages/generator/src/cli.js:4
import * as build from “./build.js”;
^^^^^^

SyntaxError: Cannot use import statement outside a module
at Module._compile (internal/modules/cjs/loader.js:891:18)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:991:10)
at Module.load (internal/modules/cjs/loader.js:811:32)
at Function.Module._load (internal/modules/cjs/loader.js:723:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
at internal/main/run_main_module.js:17:11
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! elm-pages-app@ start: elm-pages dev
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the elm-pages-app@ start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I wondering what has caused this.

My npm is 6.13.5, node is v12.14.1
My elm is 0.19.1

Hoping this is simple to fix

Ralph

1 Like

Node.js 12 is very old. It got end-of-life 3 years ago.

Try Node.js 20 or later.

Yes - that must be it. I have another Mac with node.js 20 and on that Mac my code works.

Updated node to v23.6.1 on the failing Mac - all works now.

Something must have installed an earlier version of node globally.

Thanks

1 Like

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