berry icon indicating copy to clipboard operation
berry copied to clipboard

[Bug?]: `yarn config get npmScopes --json` returns "undefined" for missing properties in v4, v3.6.4 returns "{}"

Open sonofachamp opened this issue 1 year ago • 2 comments

Self-service

  • [ ] I'd be willing to implement a fix

Describe the bug

There seems to be a regression in what yarn config get npmScopes returns between versions 3 and 4 of yarn. I haven't found any details on if this is expected behavior or not.

To reproduce

V3

.yarnrc.yml

compressionLevel: mixed

enableGlobalCache: false

yarnPath: .yarn/releases/yarn-3.6.4.cjs
> yarn --version
> 3.6.4
> yarn config get npmScopes --json
> {}

V4

.yarnrc.yml

compressionLevel: mixed

enableGlobalCache: false

yarnPath: .yarn/releases/yarn-4.1.0.cjs
> yarn --version
> 4.1.0
> yarn config get npmScopes --json
> undefined

Environment

System:
    OS: Windows 11 10.0.22631
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700K
  Binaries:
    Node: 18.16.0 - ~\AppData\Local\Temp\xfs-069f16a9\node.CMD
    Yarn: 4.1.0 - ~\AppData\Local\Temp\xfs-069f16a9\yarn.CMD
    npm: 9.8.1 - C:\Program Files\nodejs\npm.CMD

Additional context

No response

sonofachamp avatar Feb 01 '24 18:02 sonofachamp

I also encountered this problem. Is it expected to return "undefined" when passing --json?

segrey avatar May 08 '25 12:05 segrey

why is this ignored?

Pnlvfx avatar Oct 31 '25 15:10 Pnlvfx