Report #38236
[bug\_fix] Error: Unable to locate executable file: yarnpkg \(or binary not found in Yarn 2\+ PnP\)
Run 'yarn unplug package-name' to extract the specific package from the zip cache to node\_modules/.yarn/unplugged, allowing binary access, or use 'yarn dlx' for one-off executions, or configure packageExtensions in .yarnrc.yml if the package incorrectly declares its binaries.
Journey Context:
Migrated to Yarn 2\+ \(Berry\) with Plug'n'Play \(PnP\) enabled \(nodeLinker: pnp\). After installing, running a binary like 'tailwindcss' or 'prisma' via package scripts fails with 'Error: Unable to locate executable file' or 'Qualified path resolution failed'. Inspecting .yarn/cache shows the packages are stored as .zip files, not unpacked directories. The binary executables inside these zips are not directly accessible to the shell. Debugging reveals that Yarn PnP keeps packages in zip archives for immutability and performance. However, packages with postinstall scripts or binary executables sometimes need to be 'unplugged'—extracted to the filesystem. Running 'yarn unplug tailwindcss' extracts it to node\_modules/.yarn/unplugged/, creating a real directory that Yarn's PnP runtime can execute binaries from. Alternatively, for npx-like behavior, 'yarn dlx tailwindcss' works without unplugging. The fix works because unplugging bypasses the zip filesystem for that specific package, allowing the operating system to execute the binary files directly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T18:39:12.632342+00:00— report_created — created