{"record":{"id":"1e1bf9da48634b08","repo":"payloadcms/payload","slug":"payload-is-not-installed-in-this-project","errorCode":null,"errorMessage":"Payload is not installed in this project","messagePattern":"Payload is not installed in this project","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/create-payload-app/src/lib/update-payload-in-project.ts","lineNumber":151,"sourceCode":"    devDependencies?: Record<string, string>\n  }\n  if (!packageObj.dependencies && !packageObj.devDependencies) {\n    throw new Error('No package.json found in this project')\n  }\n\n  const dependencyGroups = [packageObj.dependencies, packageObj.devDependencies].filter(\n    (dependencies): dependencies is Record<string, string> => Boolean(dependencies),\n  )\n  const payloadPackageEntries = dependencyGroups.flatMap((dependencies) =>\n    Object.entries(dependencies).filter(\n      ([packageName]) => packageName === 'payload' || packageName.startsWith('@payloadcms/'),\n    ),\n  )\n  const payloadVersion = payloadPackageEntries.find(\n    ([packageName]) => packageName === 'payload',\n  )?.[1]\n  if (!payloadVersion) {\n    throw new Error('Payload is not installed in this project')\n  }\n\n  const packageManager = await getPackageManager({ projectDir })\n  const latestPayloadVersion = await resolvePackageVersion({ packageName: 'payload', versionOrTag })\n\n  if (payloadPackageEntries.every(([, version]) => version === latestPayloadVersion)) {\n    return {\n      isUpdated: false,\n      message: `Payload v${payloadVersion} is already up to date.`,\n      success: true,\n    }\n  }\n\n  const payloadPackages = payloadPackageEntries\n    .map(([packageName]) => packageName)\n    .filter((packageName) => packageName.startsWith('@payloadcms/'))\n  const packageNames = ['payload', ...new Set(payloadPackages)]\n  const packagesToUpdate = packageNames.map(","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/payloadcms/payload/blob/00c58b35c0ed348ddc22daabf467b139727214fd/packages/create-payload-app/src/lib/update-payload-in-project.ts#L133-L169","documentation":"performPayloadPackageUpdate collected all payload/@payloadcms/* entries from dependencies and devDependencies but found no entry whose package name is exactly 'payload'. The main payload package must be present to perform an update.","triggerScenarios":"Running the update flow on a project that has @payloadcms/* packages (e.g. @payloadcms/next, @payloadcms/db-postgres) but is missing the core 'payload' dependency — common in partial/manual installs or workspaces that hoisted payload elsewhere.","commonSituations":"See trigger scenarios.","solutions":["Install the core package: run `npm install payload` (or pnpm/yarn/bun equivalent) in the project root.","If payload is hoisted in a monorepo, run the update from the workspace that actually declares it, or add it explicitly.","Check both dependencies and devDependencies for an entry named exactly 'payload'.","If you only intended to add @payloadcms/* plugins, use the init flow instead of update."],"exampleFix":"// before — package.json (no core payload)\n{\n  \"dependencies\": {\n    \"@payloadcms/next\": \"3.x\",\n    \"@payloadcms/db-mongodb\": \"3.x\"\n  }\n}\n\n// after\n{\n  \"dependencies\": {\n    \"payload\": \"3.x\",\n    \"@payloadcms/next\": \"3.x\",\n    \"@payloadcms/db-mongodb\": \"3.x\"\n  }\n}","handlingStrategy":"validation","validationCode":"import fse from 'fs-extra'\nimport path from 'path'\n\nasync function assertPayloadInstalled(projectDir: string) {\n  const pkg = await fse.readJson(path.resolve(projectDir, 'package.json'))\n  const deps = { ...pkg.dependencies, ...pkg.devDependencies }\n  if (!deps?.payload) {\n    throw new Error('Core `payload` package not found in dependencies/devDependencies')\n  }\n}","typeGuard":"function hasPayload(pkg: unknown): boolean {\n  if (typeof pkg !== 'object' || pkg === null) return false\n  const p = pkg as { dependencies?: Record<string, string>; devDependencies?: Record<string, string> }\n  return Boolean(p.dependencies?.payload || p.devDependencies?.payload)\n}","tryCatchPattern":null,"preventionTips":["Always declare the core `payload` dependency in the project that runs update.","In monorepos, run update from the workspace that owns payload.","Check both dependencies and devDependencies for the literal 'payload' key."],"tags":["create-payload-app","cli","config","package-json","dependencies"],"backgroundTag":null,"analyzedSha":"00c58b35c0ed348ddc22daabf467b139727214fd","analyzedAt":"2026-08-12T20:45:03.758Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}