aio-cli icon indicating copy to clipboard operation
aio-cli copied to clipboard

Node 22 has warning in every cli command (eslint error)

Open purplecabbage opened this issue 1 year ago • 2 comments

All commands include this output ....

aio report -b
(node:61566) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

Running with --trace-deprecation flag:

node --trace-deprecation ~/.nvm/versions/node/v22.10.0/bin/aio info 
(node:64405) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
    at node:punycode:3:9
    at BuiltinModule.compileForInternalLoader (node:internal/bootstrap/realm:399:7)
    at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/realm:338:10)
    at loadBuiltinModule (node:internal/modules/helpers:114:7)
    at Function._load (node:internal/modules/cjs/loader:1100:17)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:218:24)
    at Module.require (node:internal/modules/cjs/loader:1340:12)
    at require (node:internal/modules/helpers:141:16)
    at Object.<anonymous> (/Users/jessem/.nvm/versions/node/v22.10.0/lib/node_modules/@adobe/aio-cli/node_modules/whatwg-url/lib/url-state-machine.js:2:18)

Environment Info

  System:
    OS: macOS 14.6.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 1.65 GB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.10.0 - ~/.nvm/versions/node/v22.10.0/bin/node
    Yarn: 1.22.19 - ~/.bun/bin/yarn
    npm: 10.9.0 - ~/.nvm/versions/node/v22.10.0/bin/npm
  Virtualization:
    Docker: 20.10.17 - /usr/local/bin/docker
  npmGlobalPackages:
    @adobe/aio-cli: 10.3.1

purplecabbage avatar Oct 23 '24 16:10 purplecabbage

JIRA issue created: https://jira.corp.adobe.com/browse/ACNA-3249

aiojbot avatar Oct 23 '24 17:10 aiojbot

❯ npm root -g
/Users/shazron/.nvm/versions/node/v22.11.0/lib/node_modules
❯ cd /Users/shazron/.nvm/versions/node/v22.11.0/lib/node_modules
❯ cd @adobe/aio-cli
❯ npm ls punycode
@adobe/[email protected] /Users/shazron/.nvm/versions/node/v22.11.0/lib/node_modules/@adobe/aio-cli
├─┬ @adobe/[email protected]
│ └─┬ @adobe/[email protected]
│   └─┬ [email protected]
│     └─┬ [email protected]
│       └─┬ [email protected]
│         └─┬ [email protected]
│           └── [email protected]
└─┬ @adobe/[email protected]
  └─┬ @adobe/[email protected]
    └─┬ [email protected]
      └─┬ [email protected]
        └── [email protected]

Unfortunately punycode is dependency of a dependency, will have to investigate whether they have been updated.

shazron avatar Nov 07 '24 14:11 shazron

[email protected] (the latest) does not have punycode as a dependency. [email protected] (the latest) still has the [email protected] dependency.

shazron avatar Nov 07 '24 14:11 shazron

  1. [email protected] has updated the ajv that has the required updates. However, webpack needs to have a new release that uses the new schema-utils, and that timeline for update is unknown. For now, I recommend the app-dev plugin do this: https://github.com/eslint/eslint/pull/18762/files
  2. Update swagger-client for the @adobe/aio-lib-console

shazron avatar Nov 07 '24 14:11 shazron

webpack can't update to the latest schema-utils because of node version support reasons: https://github.com/webpack/schema-utils/issues/191

shazron avatar Nov 08 '24 02:11 shazron

PR https://github.com/adobe/aio-lib-console/pull/87

shazron avatar Nov 08 '24 13:11 shazron

PR https://github.com/adobe/aio-cli-plugin-app-dev/pull/124

shazron avatar Nov 08 '24 13:11 shazron

PRs merged and released.

shazron avatar Nov 15 '24 01:11 shazron

Re-opening since the releases don't totally solve the issue yet.

shazron avatar Jan 07 '25 05:01 shazron

See https://github.com/adobe/aio-lib-core-networking/pull/84 See https://github.com/adobe/aio-cli/pull/704

shazron avatar Jan 07 '25 06:01 shazron

Hey @shazron , thanks for overriding the dependencies with n22 compatible ones! Can we expect this to be released soon? Just asking, as we plan to release a new version of our aio plugin, we may want to wait for the n22 compatibility and do this in the same go.

RemoLiechti avatar Jan 16 '25 14:01 RemoLiechti

I'm scheduling it for next week.

shazron avatar Jan 17 '25 13:01 shazron

Re-opened. In local testing the overrides works but under certain circumstances listed here: https://github.com/npm/cli/issues/5850

But when installing via npm install -g @adobe/aio-cli the overrides do not work unfortunately because we have a package-lock.json. We need to find a workaround.

This is an npm issue (Jan, Nov 2022):

  • https://github.com/npm/cli/issues/4232
  • https://github.com/npm/cli/issues/5850

This PR purportedly will fix the issue (Nov 2023):

  • https://github.com/npm/cli/pull/7025

shazron avatar Jan 21 '25 12:01 shazron

possible fixes:

  1. use dynamic import to use [email protected] which is ESM
  2. use the built in global fetch in node (experimental in node-18, stable in node-22). Experimental might be fine if we test it properly

shazron avatar Jan 21 '25 12:01 shazron

Doing fix 2 since mixing ESM with CJS in Jest tests is not trivial.

Done:

  • https://github.com/adobe/aio-cli-plugin-app-templates/pull/71
  • https://github.com/adobe/aio-cli/pull/714
  • https://github.com/adobe/aio-cli-plugin-app/pull/843
  • https://github.com/adobe/aio-cli-plugin-telemetry/pull/31

Pending:

  • @adobe/aio-lib-core-networking
  • @adobe/aio-lib-events

However, there are sub-dependencies out of our control (like octokit), not sure if it affects things yet:

├─┬ @adobe/[email protected]
│ ├─┬ @adobe/[email protected]
│ │ └── [email protected]
│ ├─┬ @adobe/[email protected]
│ │ └─┬ [email protected]
│ │   └─┬ [email protected]
│ │     └─┬ @octokit/[email protected]
│ │       └─┬ @octokit/[email protected]
│ │         └─┬ @octokit/[email protected]
│ │           └── [email protected] deduped
│ └─┬ @octokit/[email protected]
│   └─┬ @octokit/[email protected]
│     └─┬ @octokit/[email protected]
│       └── [email protected] deduped
└─┬ @adobe/[email protected]
  └─┬ @adobe/[email protected]
    └── [email protected] deduped

shazron avatar Jan 22 '25 03:01 shazron

Hi @shazron Is there news on this? We keep getting support requests raised for our aio plugin as users tend to use node 22 and 23 now, and run into problems.

RemoLiechti avatar Feb 06 '25 07:02 RemoLiechti

It's not a blocker - so it's not scheduled for work on it currently, I'm doing it on my spare time. Please raise a support issue if it's critical so it can be scheduled.

shazron avatar Feb 06 '25 08:02 shazron

@shazron since 22 is now supported in the CLI can this be closed?

pru55e11 avatar May 07 '25 17:05 pru55e11

No, this issue is caused by Node 22.

shazron avatar May 08 '25 01:05 shazron

this message is now suppressed in node >=22.14 https://github.com/nodejs/node/pull/56632 - maybe we should just make that the min required version of 22?

pru55e11 avatar May 08 '25 02:05 pru55e11

oh thank God 😅 for reference, the commit shows in the release notes, where the warning will not show if it's in node_modules: https://nodejs.org/en/blog/release/v22.14.0 commit

I say we can up it to 22.14 min, and if anyone complains they can just update their node version. This issue can be closed then

shazron avatar May 08 '25 06:05 shazron

I confirm this now works with latest aio-cli and node 22, thank you.

RemoLiechti avatar May 08 '25 06:05 RemoLiechti