[Bug?]: A list of negated os/cpu/libc values matches every platform
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- nodejs, typescript
- Domain
- tooling
Research direction
Start in packages/yarnpkg-core/sources/Manifest.ts at toConditionLine (around lines 1017-1023), where all tokens are joined with |; trace how negated os/cpu/libc entries are turned into tokens. Reproduce with the linked repro's yarn install and yarn run check, then compare with npm, which skips the package when any negated value matches. Done means the generated condition no longer matches every platform for a list like !arm, !x64, covered by a core unit test.
Written by the indexing model from the issue text.
Description
Self-service
- I'd be willing to implement a fix
Describe the bug
For "cpu": ["!arm", "!arm64", "!riscv64", "!x64"], Yarn writes:
conditions: (!cpu=arm | !cpu=arm64 | !cpu=riscv64 | !cpu=x64)
At least one term is always true, so the package installs on every platform. npm rejects a package if any negated value matches, and skips it.
Cause: toConditionLine joins all tokens with |: https://github.com/yarnpkg/berry/blob/cfa40bda203d1b0a8cc25886af19bc11b670ef84/packages/yarnpkg-core/sources/Manifest.ts#L1017-L1023
Impact: sass-embedded's fallback packages (sass-embedded-all-unknown, sass-embedded-unknown-all) install everywhere with Yarn, adding sass, chokidar and `@parcel/watcher.
To reproduce
Repro: https://github.com/marcalexiei/yarn-negated-conditions-repro
Its only dependency is the optional [email protected]:
yarn install
yarn run check
Expected: the package is skipped, as with npm.
Actual: it's installed, and the check fails:
FAIL darwin-arm64: sass-embedded-all-unknown is installed, but its cpu field excludes arm64
CI runs the check with Yarn and npm on multiple OS.
The Yarn jobs fail and the npm jobs pass: https://github.com/marcalexiei/yarn-negated-conditions-repro/actions/runs/45340412493
Environment
System:
OS: macOS 27.2.1
CPU: (8) arm64 Apple M3
Binaries:
Node: 24.22.3
Yarn: 4.19.0
npm: 11.19.1
Additional context
Related: #5962 (about evaluating negated conditions against supportedArchitectures, not about generating them).
- Dominant language
- TypeScript
- Stars
- 8.1k
- Forks
- 1.4k
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 4
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from yarnpkg/berry
-
[Bug?]: `yarn upgrade-interactive` drops the prerelease suffix from suggested versionsPossibly taken @lucas-gomes-santana claimed this 5 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
[Bug?]: `yarn upgrade-interactive` silently ignores errors when checking package versionsPossibly taken A pull request linked to this issue is open or already merged. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
[Bug?]: Disabling global `npmMinimalAgeGate` does not disable scoped `npmMinimalAgeGate`Possibly taken @ychampion claimed this 137 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
yarnpkg/berry#7192 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
[Bug?]: [Docs] Duplication of yarn command in the CLI documentationPossibly taken @Hashim1999164 claimed this 119 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
Similar issues
-
External sources always come back in English: `lc` isn't passed to `/api/v3/external_sources`Possibly taken @Anurag1428 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
openfoodfacts/openfoodfacts-explorer#2264 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
cloudflare/workers-sdk#17139 ·
Maintainers usually reply within 1 day
-
area: editor P3 type: feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
halisonworks/mod-codeling#290 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
colinhacks/zod#6776 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
aws/aws-sdk-js-v3#8441 ·
Maintainers usually reply within 1 day