Forge CLI does not support latest Node.js LTS version

When using any forge command (e.g. forge --version) in a node environment using the latest LTS version v22.11.0 we get the following warning message:

(node:67301) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Warning: Forge CLI supports Node.js 18.x or 20.x.
Unsupported Node.js versions are not guaranteed to work correctly.

I am using version 10.12.0 of the @forge/cli package installed using npm.

Is there a roadmap when forge CLI will start supporting Node.js 22?

We are currently using forge CLI commands inside docker containers that come with Playwright for e2e testing. The environment inside those docker containers was upgraded to Node.js 22 with @playwright/test v1.49.0. This appears to have broken our setup.

Hi Simon,

Forge currently doesn’t support Node 22. You can use Node 20 in the meantime.

Amazon only just released their support Node 22 for Lambdas on the 22nd Nov (Node.js 22 runtime now available in AWS Lambda | AWS Compute Blog).

Good news though, we will be releasing the Node 22 Runtime this side of Christmas if all goes to plan.

Cheers
Ben

Hi Benny,

Thanks for the info. We are looking forward to the update!

Just to make sure we are on the same page: I am not talking about the node runtime version specified in our app’s manifest.yml. Presumably that refers to the version used for executing forge backend calls inside AWS Lambdas.
Instead I am talking about the node version installed on my local machine when executing CLI commands like forge deploy.

I can see that it might make sense for you guys to update the supported node versions for both of these scenarios simultaneously though.

Best,
Simon

Thanks for this feedback Simon.

I have passed this onto the relevant team to fix this issue.
Thanks for raising it to our attention.

Any updates on this?
Looks like the @forge/cli package still only supports Node major versions 18 and 20.

Via @forge/cli - npm you can see that in the currently released version, the file /@forge/cli/out/command-line/version-info.js contains the following on line 23:
const supportedNodeMajorVersions = [18, 20];

Hi Simon,

The latest @forge/cli package 11.1.0 and later now supports Node version 22.

@LucyChen @Benny I am trying to run e2e tests in CI, which invoke the Forge CLI. Those tests run on the latest LTS version, but the CLI complains that it only likes node 20 and 22 (not 24, which is the latest LTS).

The warnings are annoying because they also get printed when we run forge install list --json. This does, in fact, return the list of installations, but parsing the JSON fails because the Forge CLI prints the following warning together with the JSON output: Warning: Forge CLI supports Node.js 20.x or 22.x. Unsupported Node.js versions are not guaranteed to work correctly.

As highlighted above, https://cdn.jsdelivr.net/npm/@forge/cli@12.12.0/out/command-line/version-info.js has a check which includes const supportedNodeMajorVersions = [20, 22];

Why is there a need for this check? It’s pretty annoying, especially because it is not aligned with what the package.json says:

"engines": {
    "node": ">=20.0.0"
  },

I am pretty sure if the node version does not align with the engines spec in the package.json node will complain on its own.

Can the supportedNodeMajorVersions be bumped to include 24?

Hey @tbinna thanks for raising this.

This check for in the CLI for supported Node.js versions is intended to keep CLI aligned with the node runtimes that are available, and to warn when users are running Node versions that haven’t been validated with the current CLI release. Node 24 was recently added as an available runtime so we are working through testing at the moment and planning on adding to the supportedNodeMajorVersions soon.

I agree these kinds of warnings should be directed to stderr instead of stdout so this doesn’t break commands with --json, I’ve raised bug ticket for this here https://jira.atlassian.com/browse/ECO-1233, please vote or comment if you have additional input.