yarnpkg / berry

📦🐈 Active development trunk for Yarn ⚒
https://yarnpkg.com
BSD 2-Clause "Simplified" License
7.47k stars 1.12k forks source link

[Bug?]: TypeError: le.trim is not a function when running yarn npm audit -AR #6554

Open RikClaessens opened 1 month ago

RikClaessens commented 1 month ago

Self-service

Describe the bug

When I run yarn npm audit --recursive / yarn npm audit -R, so with the recursive option enabled I receive the following error:

YN0001: TypeError: le.trim is not a function
    at /.yarn/releases/yarn-4.5.0.cjs:694:1891
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async AA.start (/.yarn/releases/yarn-4.5.0.cjs:199:6855)
    at async SC.execute (/.yarn/releases/yarn-4.5.0.cjs:694:1231)
    at async SC.validateAndExecute (/.yarn/releases/yarn-4.5.0.cjs:94:787)
    at async t.run (/.yarn/releases/yarn-4.5.0.cjs:98:3249)
    at async fPt (/.yarn/releases/yarn-4.5.0.cjs:735:7743)
    at async Wx (/.yarn/releases/yarn-4.5.0.cjs:736:142)

Some inspection makes me have a hunch that the dependency @backstage/plugin-scaffolder-backend-module-bitbucket could be the cause. Since the value of le seems to resolve to a boolean value of true and thus true.trim() is not a function.

I've created a minimal reproduction here: https://github.com/RikClaessens/yarn-npm-audit-error

To reproduce

Use the repo here: https://github.com/RikClaessens/yarn-npm-audit-error

Or:

  1. In any project, yarn add @backstage/plugin-scaffolder-backend-module-bitbucket.
  2. yarn npm audit -AR

Environment

System: OS: macOS 14.5 CPU: (10) arm64 Apple M1 Pro Binaries: Node: 20.18.0 - /private/var/folders/6q/ym614jjs5933p6k4k8j0k29h0000gn/T/xfs-adc16c48/node Yarn: 4.5.0 - /private/var/folders/6q/ym614jjs5933p6k4k8j0k29h0000gn/T/xfs-adc16c48/yarn npm: 10.8.2 - ~/.nvm/versions/node/v20.18.0/bin/npm bun: 1.0.14 - /opt/homebrew/bin/bun

Additional context

No response