Skip to content

Improve error message when running CLI with unsupported Node.js version #763

@7amed3li

Description

@7amed3li

Hey everyone,

While testing the latest @nodesecure/cli, I noticed that running nsecure cwd on Node.js v20.19.0 crashes immediately.

The error is:

TypeError: Promise.withResolvers is not a function

Screenshot: :

Image

This seems related to Promise.withResolvers(), which is not available in Node 20.

I know the current CLI targets newer Node.js versions, so this may not be a Node 20 support issue.
The main problem is that the CLI currently fails with an internal stack trace, which can be confusing for users who install and run it with an unsupported Node.js version.

Maybe we can improve this by adding an early Node.js version check before executing the CLI commands.

Example message:

@nodesecure/cli requires Node.js >=24.
Current version: v20.19.0

Environment:

  • OS: Windows
  • Node.js: v20.19.0
  • Command: nsecure cwd
  • CLI version: latest installed from npm

I can open a small PR for this if you think this improvement makes sense.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions