Skip to content
Latchkey

Yarn Berry enableScripts:false Skips postinstall - Fix Missing Native Setup in CI

Yarn Berry can disable package build scripts globally with enableScripts: false (or per-package) for supply-chain safety. Like npm’s ignore-scripts, that leaves packages needing a postinstall - native addons, binary downloads - incomplete, so they fail at runtime.

What this error means

Install succeeds under Yarn Berry, but a package that depends on a build/postinstall step is missing its native artifact and crashes at runtime. Inspecting .yarnrc.yml shows enableScripts: false (or the package excluded from enableScripts/dependenciesMeta).

Yarn / runtime output
# .yarnrc.yml: enableScripts: false
# later at runtime:
Error: Could not load the native binding
'/app/.yarn/unplugged/some-native.../build/Release/addon.node'
# the build script that produces addon.node was skipped

Common causes

Build scripts disabled globally

enableScripts: false turns off all package build scripts. Packages that legitimately compile natives or fetch binaries in their build step are left incomplete.

A specific package’s scripts not enabled

With scripts disabled by default, a package whose build is not explicitly allowed (via dependenciesMeta.<pkg>.built) never runs its build.

How to fix it

Allow builds for the packages that need them

Re-enable the build for the specific native packages, or rebuild them.

.yarnrc.yml / package.json
# .yarnrc.yml - keep scripts off but allow specific builds
# (or set per-package in package.json dependenciesMeta)
"dependenciesMeta": {
  "some-native": { "built": true }
}
# then reinstall so the build runs
yarn install

Audit which packages need a build

  1. Identify dependencies that compile natives or download binaries in postinstall.
  2. Allow their builds explicitly rather than disabling the safety setting wholesale.
  3. Confirm the native artifact exists after install before relying on it.

How to prevent it

  • Allow builds narrowly for trusted native packages.
  • Inventory postinstall-dependent deps before disabling scripts.
  • Verify native artifacts exist after a scripts-disabled install.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →