{"record":{"id":"04fee734c3f889b1","repo":"Budibase/budibase","slug":"pnpm-is-required-to-run-this-project-pnpm-lock-ya","errorCode":null,"errorMessage":"pnpm is required to run this project (pnpm-lock.yaml or packageManager indicates pnpm).","messagePattern":"pnpm is required to run this project \\(pnpm-lock\\.yaml or packageManager indicates pnpm\\)\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/exec.ts","lineNumber":61,"sourceCode":"\n  // Otherwise select based on lock files. Default to yarn if multiple exist.\n  if (fs.existsSync(yarnLock)) return \"yarn\"\n  if (fs.existsSync(pnpmLock)) return \"pnpm\"\n  if (fs.existsSync(npmLock)) return \"npm\"\n\n  return \"auto\"\n}\n\nexport async function runPkgCommand(command: string, dir = \"./\") {\n  const preferred = resolvePackageManager(dir)\n  const yarn = await utilityInstalled(\"yarn\")\n  const npm = await utilityInstalled(\"npm\")\n  const pnpm = await utilityInstalled(\"pnpm\")\n\n  // Use the plugin's lockfile/packageManager when available, otherwise default to yarn.\n  if (preferred === \"pnpm\") {\n    if (!pnpm) {\n      throw new Error(\n        \"pnpm is required to run this project (pnpm-lock.yaml or packageManager indicates pnpm).\"\n      )\n    }\n    const pnpmCmd =\n      command === \"install\" ? \"pnpm install\" : `pnpm run ${command}`\n    await exec(pnpmCmd, dir)\n    return\n  }\n\n  if (preferred === \"npm\") {\n    if (!npm) {\n      throw new Error(\n        \"npm is required to run this project (package-lock.json or packageManager indicates npm).\"\n      )\n    }\n    const npmCmd =\n      command === \"install\" ? `npm ${command}` : `npm run ${command}`\n    await exec(npmCmd, dir)","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/cli/src/exec.ts#L43-L79","documentation":"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.","triggerScenarios":"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.","commonSituations":"Cloning a community plugin scaffolded with pnpm and building it on a machine with only npm/yarn; CI images lacking pnpm; corepack not enabled.","solutions":["Install pnpm: `npm install -g pnpm` or `corepack enable && corepack prepare pnpm@latest --activate`","Alternatively remove pnpm-lock.yaml and the packageManager field so detection falls back to npm/yarn (then reinstall deps with the available manager)","In CI, add a pnpm setup step (e.g. actions/setup-pnpm or corepack) before running budi commands","Verify with `pnpm --version` that it is on PATH"],"exampleFix":"// before (package.json)\n{ \"packageManager\": \"pnpm@9.0.0\" }  // pnpm not installed\n// after\n$ corepack enable && corepack prepare pnpm@9.0.0 --activate\n$ budi plugins build","handlingStrategy":"validation","validationCode":"const { execSync } = require(\"child_process\")\nconst fs = require(\"fs\")\nfunction assertPnpmAvailable(dir = \".\") {\n  const pkg = JSON.parse(fs.readFileSync(dir + \"/package.json\", \"utf8\"))\n  const wantsPnpm = fs.existsSync(dir + \"/pnpm-lock.yaml\") ||\n    (pkg.packageManager || \"\").startsWith(\"pnpm@\")\n  if (wantsPnpm) execSync(\"pnpm --version\", { stdio: \"ignore\" }) // throws if missing\n}","typeGuard":null,"tryCatchPattern":"try {\n  await runPkgCommand(\"build\", dir)\n} catch (err) {\n  if ((err as Error).message.startsWith(\"pnpm is required\")) {\n    console.error(\"Install pnpm first: npm i -g pnpm (or: corepack enable)\")\n  }\n  throw err\n}","preventionTips":["Enable corepack so the packageManager field auto-provisions the right tool","Check `pnpm --version` in CI before running budi plugin commands","Keep the plugin's lockfile consistent with the manager actually installed on build machines","Document required tooling in the plugin repo README"],"tags":["cli","plugins","pnpm","package-manager","environment"],"backgroundTag":"missing-package-manager","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}