Report #62341
[bug\_fix] YN0001: Exception thrown, but no diagnostic code: YN0001: ... incompatible architecture \(darwin-arm64 vs linux-x64\)
Use yarn unplug to extract the package to a physical .yarn/unplugged directory so it can access native binaries, or configure supportedArchitectures in .yarnrc.yml to explicitly list both os and cpu combinations, or ensure the package is compiled inside the target Docker container. Root cause: Yarn PnP \(Plug'n'Play\) with zero-installs caches native binaries for the host architecture \(e.g., macOS ARM64\) but the container/runtime expects Linux x64, causing binary incompatibility.
Journey Context:
You enable Yarn Berry with nodeLinker: pnp and check in .yarn/cache for zero-installs. You develop on an M1 Mac. Everything works locally. You push to CI which runs in a Linux x64 container. The build fails with YN0001 and mentions incompatible architecture \(darwin-arm64 vs linux-x64\) in a package like sharp, bcrypt, or esbuild. You realize that .yarn/cache contains the native .node binaries compiled for your Mac's ARM64 architecture, but CI needs Linux x64 binaries. In classic node\_modules, npm would rebuild on install, but with Yarn PnP and zero-installs, you're expected to check in portable packages. You have three options: 1\) Stop using zero-installs and add .yarn/cache to .gitignore, letting CI fetch and build native deps, 2\) Use yarn unplug bcrypt to extract it to .yarn/unplugged with a real node\_modules directory where it can be rebuilt per architecture, or 3\) Configure .yarnrc.yml with supportedArchitectures: os: \[darwin, linux\] and cpu: \[arm64, x64\] to allow Yarn to fetch and cache binaries for multiple architectures. The fix works because Yarn PnP replaces node\_modules with a content-addressable cache and .pnp.cjs loader; native addons must either be architecture-agnostic, unplugged for per-environment compilation, or cached for multiple architectures.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T11:07:22.687023+00:00— report_created — created