{"record":{"id":"7a5fc4b6740e72c7","repo":"angular/angular-cli","slug":"package-name-is-not-installed","errorCode":null,"errorMessage":"Package ${name} is not installed.","messagePattern":"Package (.+?) is not installed\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/angular/cli/src/commands/update/update-resolver.ts","lineNumber":440,"sourceCode":"function getInstalledVersion(packageName: string, workspaceRoot: string): string | null {\n  const pkgJson = getInstalledPackageJson(packageName, workspaceRoot);\n\n  return pkgJson?.version ?? null;\n}\n\nfunction _buildLocalPackageInfo(\n  name: string,\n  allDependencies: ReadonlyMap<string, VersionRange>,\n  workspaceRoot: string,\n): PackageInfo {\n  const packageJsonRange = allDependencies.get(name);\n  if (!packageJsonRange) {\n    throw new Error(`Package ${JSON.stringify(name)} was not found in package.json.`);\n  }\n\n  const localPkgJson = getInstalledPackageJson(name, workspaceRoot);\n  if (!localPkgJson) {\n    throw new Error(`Package ${name} is not installed.`);\n  }\n\n  const installedVersion = localPkgJson.version;\n  const npmPackageJson: PackageMetadata = {\n    name,\n    versions: [installedVersion],\n    'dist-tags': {},\n  };\n\n  const logger = new logging.NullLogger();\n\n  return {\n    name,\n    npmPackageJson,\n    installed: {\n      version: installedVersion as VersionRange,\n      packageJson: localPkgJson,\n      updateMetadata: _getUpdateMetadata(localPkgJson, logger),","sourceCodeStart":422,"sourceCodeEnd":458,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular/cli/src/commands/update/update-resolver.ts#L422-L458","documentation":"After confirming the package is declared in package.json, _buildLocalPackageInfo loads the installed package's package.json via getInstalledPackageJson(name, workspaceRoot). If the package is not physically installed in node_modules (or cannot be resolved from the workspace root), it throws 'Package <name> is not installed.'","triggerScenarios":"Running `ng update <name>` when the package is in package.json but absent from node_modules — after a fresh clone without npm install, a failed/partial install, or the package being pruned.","commonSituations":"Fresh checkout running ng update before installing dependencies; deleted/corrupted node_modules; yarn/pnpm workspaces where hoisting hides the package; CI caches missing the package.","solutions":["Run `npm install` (or yarn/pnpm install) to restore node_modules, then retry ng update.","Verify installation with `npm ls <name>`; reinstall specifically with `npm install <name>`.","Clear caches and reinstall if node_modules is corrupted (`rm -rf node_modules && npm ci`)."],"exampleFix":"// before (fresh clone)\nng update @angular/core\n// error: Package @angular/core is not installed.\n// after\nnpm install\nng update @angular/core","handlingStrategy":"validation","validationCode":"import { existsSync } from 'fs';\nimport { resolve } from 'path';\nconst installed = existsSync(resolve(workspaceRoot, 'node_modules', name, 'package.json'));\nif (!installed) {\n  throw new Error(`${name} missing from node_modules — run npm install first`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always run npm/yarn/pnpm install after cloning before ng update.","Run `npm ls <name>` as a preflight check in update scripts.","Rebuild node_modules from lockfile (npm ci) if installs were partial or corrupted."],"tags":["angular","cli","update","npm","node-modules","environment"],"backgroundTag":"package-not-installed","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}