Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RudderTyper doesn't work on Node 22 #86

Open
princed opened this issue Nov 21, 2024 · 3 comments
Open

RudderTyper doesn't work on Node 22 #86

princed opened this issue Nov 21, 2024 · 3 comments

Comments

@princed
Copy link

princed commented Nov 21, 2024

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.

@akashrpo
Copy link

Hi @princed, thanks for the feedback! We'll update this to ensure compatibility with Node.js v22.

@akashrpo
Copy link

akashrpo commented Dec 3, 2024

Which command was used to run the generator? Can you please share more info on the steps?

@princed
Copy link
Author

princed commented Dec 4, 2024

Basically any command, even --help or --version

Node 20

⋊> node --version
v20.17.0
⋊> rudder-typer --version
(node:18480) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Version: 1.3.0

Node 22

⋊> node --version
v22.11.0
⋊> rudder-typer --version
[...]/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

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

No branches or pull requests

2 participants