Skip to content

@gitbeaker/cli does not work on Node 22 #3591

@kashz

Description

@kashz

Description

  • Node.js version: 22.2.0
  • Gitbeaker version: 40.0.3
  • Gitbeaker release (cli, rest, core, requester-utils): core, cli
$ gitbeaker --version
file:///Users/xxx/.asdf/installs/nodejs/22.2.0/lib/node_modules/@gitbeaker/cli/dist/index.mjs:5
import API_MAP from '@gitbeaker/core/map.json' assert { type: 'json' };
                                               ^^^^^^

SyntaxError: Unexpected identifier 'assert'
    at compileSourceTextModule (node:internal/modules/esm/utils:337:16)
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:163:18)
    at callTranslator (node:internal/modules/esm/loader:430:14)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:436:30)
    at async ModuleJob._link (node:internal/modules/esm/module_job:106:19)

Node.js v22.2.0

I've encountered an issue where @gitbeaker/cli does not work with Node 22.
This is because the assert keyword has been removed in Node 22.

nodejs/node#52104

Replacing it with the with keyword should resolve the issue, but the with keyword does not work on Node versions less than 18.20.0, which may affect the supported Node versions.

Checklist

  • I have checked that this is not a duplicate issue.
  • I have read the documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    releasedThis issue/pull request has been released.type:hot fixChanges fix a critical bug

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions