Budibase/budibase · error
Must have yarn or npm installed to run build.
Error message
Must have yarn or npm installed to run build.
What it means
This is the terminal fallback in runPkgCommand: when the project provides no packageManager/lockfile signal (resolvePackageManager returns "auto"), the CLI tries npm then yarn; if neither binary is installed it cannot run any package script and throws this error.
Source
Thrown at packages/cli/src/exec.ts:113
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) {
await exec(`yarn ${command} --ignore-engines`, dir)
return
}
throw new Error("Must have yarn or npm installed to run build.")
}
View on GitHub (pinned to a81a902e9a)
Solutions
- Install Node.js (which bundles npm) from nodejs.org or via nvm, then verify `npm --version`
- Fix PATH in the execution environment (CI step, sudo secure_path, shell profile) so node/npm are found
- Add a lockfile or packageManager field so a specific manager is detected, and install that manager
- If using nvm, ensure `nvm use` runs in non-interactive shells (e.g. CI) before invoking budi
Example fix
// CI before
- run: budi plugins build # no node/npm in image
// after
- uses: actions/setup-node@v4
with: { node-version: 20 }
- run: budi plugins build Defensive patterns
Strategy: validation
Validate before calling
const { execSync } = require("child_process")
function assertAnyPkgManager() {
const ok = (cmd) => { try { execSync(cmd, { stdio: "ignore" }); return true } catch { return false } }
if (!ok("npm --version") && !ok("yarn --version")) {
throw new Error("Install Node.js (npm) or yarn before running budi plugin commands")
}
} Try / catch
try {
await runPkgCommand("build", dir)
} catch (err) {
if ((err as Error).message === "Must have yarn or npm installed to run build.") {
console.error("No package manager on PATH; install Node.js first")
}
throw err
} Prevention
- Install Node.js before using the budi CLI
- If using nvm, ensure it's loaded in non-interactive shells (CI, scripts)
- Check `which node`/`which npm` when running under sudo or systemd
- Add a tooling preflight step in CI images
When it happens
Trigger: Running budi plugin init/build/watch or the Svelte 5 migration in a plugin directory with no packageManager field and no lockfile, on a machine where both `npm --version` and `yarn --version` fail (Node.js not installed, or PATH not including the node bin directory).
Common situations: Fresh machines/containers without Node.js; running the CLI under sudo or systemd with a stripped PATH; broken nvm setup where the default node version isn't loaded in non-interactive shells.
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
- yarn is required to run this project (yarn.lock or packageMa
- 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/afde318bd11ffe4d.
Report an issue: GitHub.