Budibase/budibase · error
yarn is required to run this project (yarn.lock or packageMa
Error message
yarn is required to run this project (yarn.lock or packageManager indicates yarn).
What it means
For projects detected as yarn-based (yarn.lock or packageManager "yarn@"), runPkgCommand prefers running via yarn (with --ignore-engines). If yarn is missing it falls back to npm, but if npm is also unavailable it has no way to run the command and throws this error naming yarn as the expected tool.
Source
Thrown at packages/cli/src/exec.ts:90
if (!npm) {
throw new Error(
"npm is required to run this project (package-lock.json or packageManager indicates npm)."
)
}
const npmCmd =
command === "install" ? `npm ${command}` : `npm run ${command}`
await exec(npmCmd, dir)
return
}
// If the project indicates yarn, use it (with npm fallback).
if (preferred === "yarn") {
if (yarn) {
await exec(`yarn ${command} --ignore-engines`, dir)
return
}
if (!npm) {
throw new Error(
"yarn is required to run this project (yarn.lock or packageManager indicates yarn)."
)
}
const npmCmd =
command === "install" ? `npm ${command}` : `npm run ${command}`
await exec(npmCmd, dir)
return
}
// Default to npm when the project has no lockfile/packageManager signal.
if (npm) {
const npmCmd =
command === "install" ? `npm ${command}` : `npm run ${command}`
await exec(npmCmd, dir)
return
}
if (yarn) {View on GitHub (pinned to a81a902e9a)
Solutions
- Install yarn: `npm install -g yarn` or `corepack enable`
- If yarn isn't wanted, ensure npm is installed so the fallback works
- Fix PATH so node package managers are discoverable (`which npm`, `which yarn`)
- Remove yarn.lock / packageManager field to switch detection to an installed manager
Example fix
// before $ budi plugins build # yarn.lock present, no yarn/npm installed // after $ corepack enable && yarn --version && budi plugins build
Defensive patterns
Strategy: validation
Validate before calling
const { execSync } = require("child_process")
const fs = require("fs")
function assertPackageManagerAvailable(dir = ".") {
const wantsYarn = fs.existsSync(dir + "/yarn.lock") ||
(JSON.parse(fs.readFileSync(dir + "/package.json", "utf8")).packageManager || "").startsWith("yarn@")
if (wantsYarn) {
try { execSync("yarn --version", { stdio: "ignore" }) }
catch { execSync("npm --version", { stdio: "ignore" }) } // npm fallback must exist
}
} Try / catch
try {
await runPkgCommand("build", dir)
} catch (err) {
if ((err as Error).message.startsWith("yarn is required")) {
console.error("Install yarn (corepack enable) or npm so the fallback works")
}
throw err
} Prevention
- Enable corepack to get yarn automatically for yarn.lock projects
- Ensure at least npm exists as a fallback wherever builds run
- Verify PATH includes node bin dirs in CI/sudo contexts
- Remove yarn.lock if the team standardized on another manager
When it happens
Trigger: Running budi plugin commands in a directory with yarn.lock (or packageManager: "yarn@...") on a machine that has neither yarn nor npm on PATH — e.g. minimal CI containers, broken Node installs, or PATH issues under sudo.
Common situations: CI images with only a bare node runtime; macOS/Linux machines where Node was removed but yarn.lock left behind; running the CLI in an environment where PATH doesn't include node bin dirs.
Related errors
- pnpm is required to run this project (pnpm-lock.yaml or pack
- npm is required to run this project (package-lock.json or pa
- Must have yarn or npm installed to run build.
- Unable to access MinIO/S3 - check environment config.
- CLOUDFRONT_PRIVATE_KEY_64 is not set
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/356f986c64e89d74.
Report an issue: GitHub.