Budibase/budibase · error

pnpm is required to run this project (pnpm-lock.yaml or pack

Error message

pnpm is required to run this project (pnpm-lock.yaml or packageManager indicates pnpm).

What it means

runPkgCommand detects the package manager for a plugin project from its `packageManager` field or lockfile. If detection resolves to pnpm (pnpm-lock.yaml present or packageManager starts with "pnpm@") but the pnpm binary is not installed on PATH, it throws instead of silently using another manager, since installing with a different manager could produce a broken node_modules.

Source

Thrown at packages/cli/src/exec.ts:61

  // Otherwise select based on lock files. Default to yarn if multiple exist.
  if (fs.existsSync(yarnLock)) return "yarn"
  if (fs.existsSync(pnpmLock)) return "pnpm"
  if (fs.existsSync(npmLock)) return "npm"

  return "auto"
}

export async function runPkgCommand(command: string, dir = "./") {
  const preferred = resolvePackageManager(dir)
  const yarn = await utilityInstalled("yarn")
  const npm = await utilityInstalled("npm")
  const pnpm = await utilityInstalled("pnpm")

  // Use the plugin's lockfile/packageManager when available, otherwise default to yarn.
  if (preferred === "pnpm") {
    if (!pnpm) {
      throw new Error(
        "pnpm is required to run this project (pnpm-lock.yaml or packageManager indicates pnpm)."
      )
    }
    const pnpmCmd =
      command === "install" ? "pnpm install" : `pnpm run ${command}`
    await exec(pnpmCmd, dir)
    return
  }

  if (preferred === "npm") {
    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)

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Install pnpm: `npm install -g pnpm` or `corepack enable && corepack prepare pnpm@latest --activate`
  2. Alternatively remove pnpm-lock.yaml and the packageManager field so detection falls back to npm/yarn (then reinstall deps with the available manager)
  3. In CI, add a pnpm setup step (e.g. actions/setup-pnpm or corepack) before running budi commands
  4. Verify with `pnpm --version` that it is on PATH

Example fix

// before (package.json)
{ "packageManager": "pnpm@9.0.0" }  // pnpm not installed
// after
$ corepack enable && corepack prepare pnpm@9.0.0 --activate
$ budi plugins build
Defensive patterns

Strategy: validation

Validate before calling

const { execSync } = require("child_process")
const fs = require("fs")
function assertPnpmAvailable(dir = ".") {
  const pkg = JSON.parse(fs.readFileSync(dir + "/package.json", "utf8"))
  const wantsPnpm = fs.existsSync(dir + "/pnpm-lock.yaml") ||
    (pkg.packageManager || "").startsWith("pnpm@")
  if (wantsPnpm) execSync("pnpm --version", { stdio: "ignore" }) // throws if missing
}

Try / catch

try {
  await runPkgCommand("build", dir)
} catch (err) {
  if ((err as Error).message.startsWith("pnpm is required")) {
    console.error("Install pnpm first: npm i -g pnpm (or: corepack enable)")
  }
  throw err
}

Prevention

When it happens

Trigger: Running `budi plugin init/build/watch` or `budi plugin migrate svelte5` (runPkgCommand) inside a plugin directory that contains pnpm-lock.yaml or declares "packageManager": "pnpm@..." while `pnpm --version` fails on the machine.

Common situations: Cloning a community plugin scaffolded with pnpm and building it on a machine with only npm/yarn; CI images lacking pnpm; corepack not enabled.

Related errors


AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29). Data as JSON: /api/errors/04fee734c3f889b1. Report an issue: GitHub.