{"record":{"id":"d4d7114eb564e368","repo":"refinedev/refine","slug":"package-manager-not-found","errorCode":null,"errorMessage":"Package manager not found.","messagePattern":"Package manager not found\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/utils/package/index.ts","lineNumber":161,"sourceCode":"    outdatedJson: [\"outdated\", \"--format\", \"json\"],\n    install: [\"install\"],\n  },\n  bun: {\n    add: [\"add\"],\n    addDev: [\"add\", \"--dev\"],\n    outdatedJson: [\"outdated\", \"--format\", \"json\"],\n    install: [\"install\"],\n  },\n};\n\nexport const getPreferedPM = async () => {\n  const pm = await spinner(\n    () => preferredPM(process.cwd()),\n    \"Getting package manager...\",\n  );\n\n  if (!pm) {\n    throw new Error(\"Package manager not found.\");\n  }\n\n  return pm;\n};\n\nexport const installPackages = async (\n  packages: string[],\n  type: \"all\" | \"add\" = \"all\",\n  successMessage = \"All `Refine` packages updated  🎉\",\n) => {\n  const pm = await getPreferedPM();\n\n  try {\n    const installCommand =\n      type === \"all\" ? pmCommands[pm.name].install : pmCommands[pm.name].add;\n\n    const execution = execa(pm.name, [...installCommand, ...packages], {\n      stdio: \"inherit\",","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/refinedev/refine/blob/779d52a20e29b0307ac0df04d135beba434370dc/packages/cli/src/utils/package/index.ts#L143-L179","documentation":"getPreferedPM uses the preferred-pm package to detect which package manager owns the current project (via lockfiles). If no npm/yarn/pnpm lockfile is found, it returns null and refine CLI throws this error before installing packages.","triggerScenarios":"Running a refine CLI command that installs packages in a directory with no package-lock.json, yarn.lock, or pnpm-lock.md.","commonSituations":"Fresh directory with package.json created manually but no install run yet; lockfile deleted or gitignored; using a less common package manager (bun) not recognized by preferred-pm.","solutions":["Run `npm install` (or yarn/pnpm install) once to generate a lockfile, then retry the CLI command","If using bun, install the desired refine packages manually with `bun add`","Ensure you're in the correct project directory containing the lockfile"],"exampleFix":"# before\nrefine add provider supabase   # no lockfile present\n# after\nnpm install\nrefine add provider supabase","handlingStrategy":"validation","validationCode":"const hasLock = ['package-lock.json','yarn.lock','pnpm-lock.yaml'].some(f => existsSync(f));\nif (!hasLock) await installOnce(); // generate lockfile","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run one install to create a lockfile before using CLI install features","Stick to one package manager per project"],"tags":["cli","package-manager","lockfile"],"backgroundTag":"package-manager-not-detected","analyzedSha":"779d52a20e29b0307ac0df04d135beba434370dc","analyzedAt":"2026-08-27T11:15:25.854Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}