Skip to content

RudderTyper doesn't work on Node 22 #86

@princed

Description

@princed

RudderTyper fails with the following error when running under Node 22, which now in Active LTS status:

[...]/node_modules/rudder-typer/src/cli/index.js:18
import packageJson from '../../package.json' assert { type: 'json' };
                                             ^^^^^^

SyntaxError: Unexpected identifier 'assert'
    at compileSourceTextModule (node:internal/modules/esm/utils:340:16)
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:102:18)
    at #translate (node:internal/modules/esm/loader:433:12)
    at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:480:27)
    at async ModuleJob._link (node:internal/modules/esm/module_job:112:19)

Node.js v22.11.0

Process finished with exit code 1

That is because assert support has been removed from Node in favour of with that is based on a more recent version of Import Attributes proposal.

If I manually change all the assert keywords to with, everything works as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions