cli icon indicating copy to clipboard operation
cli copied to clipboard

Invalid dependency in modern Yarn

Open matejchalk opened this issue 4 months ago • 0 comments

What happened?

When running Code PushUp CLI in a Yarn 4 project, I get the following error:

node:internal/process/esm_loader:34
      internalBinding('errors').triggerUncaughtException(
                                ^
Error: @code-pushup/cli tried to access vscode-material-icons, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

Required package: vscode-material-icons (via "vscode-material-icons/package.json")
Required by: @code-pushup/cli@npm:0.51.0 (via /home/matejchalk/.yarn/berry/cache/@code-pushup-cli-npm-0.51.0-f7bc3b2931-10c0.zip/node_modules/@code-pushup/cli/index.js)

    at makeError (/home/matejchalk/Documents/yarn-modern-test/.pnp.cjs:6593:34)
    at resolveToUnqualified (/home/matejchalk/Documents/yarn-modern-test/.pnp.cjs:8231:21)
    at Object.resolveToUnqualified (/home/matejchalk/Documents/yarn-modern-test/.pnp.cjs:8411:26)
    at resolve$1 (file:///home/matejchalk/Documents/yarn-modern-test/.pnp.loader.mjs:2031:31)
    at nextResolve (node:internal/modules/esm/hooks:865:28)
    at Hooks.resolve (node:internal/modules/esm/hooks:303:30)
    at handleMessage (node:internal/modules/esm/worker:196:24)
    at Immediate.checkForMessages (node:internal/modules/esm/worker:138:28)
    at process.processImmediate (node:internal/timers:478:21)

What would you expect to happen?

Internal dependencies of @code-pushup/cli should be properly defined for modern Yarn.

What steps did you take?

  1. Install Yarn 2+ if you haven't already (e.g. with corepack enable).
  2. Create a new folder and initialize a Yarn project with yarn init -2.
  3. Install CLI with yarn add -D @code-pushup/cli.
  4. Run CLI with yarn code-pushup.

Code PushUp package version

0.51.0

What operation system are you on?

Linux

Node version

20.11.0

Relevant log output

No response

matejchalk avatar Oct 11 '24 13:10 matejchalk