Skip to content

Conversation

ekohilas
Copy link
Contributor

Reopening of #1422

In Node 18.18, the following error occurs:

npx --yes gitlab-ci-local@latest                                                                                                                                                 
file:///Users/username/.npm/_npx/3f18f2096def1b34/node_modules/gitlab-ci-local/src/index.js:13
import packageJson from "../package.json" with { type: "json" };
                                          ^^^^

SyntaxError: Unexpected token 'with'
    at ESMLoader.moduleStrategy (node:internal/modules/esm/translators:119:18)
    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:468:14)
    at async link (node:internal/modules/esm/module_job:68:21)

Node.js v18.18.2

This PR fixes the issue by converting json imports to instead use readfilesync and JSON.parse instead, which makes it more explicit and avoids this error.

This fix allows users who may otherwise not be able to update to Node v18.20 overnight to continue using this tool.

Thanks again!

@firecow
Copy link
Owner

firecow commented Nov 14, 2024

@ANGkeith You sure we wanna keep node 18 support?

@firecow firecow merged commit 3c41ae5 into firecow:master Nov 14, 2024
9 checks passed
@ANGkeith
Copy link
Collaborator

hmm not really, but at least for now, does'nt seem like there is too much incompatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants