{"record":{"id":"69cd9ecae62e002e","repo":"angular/angular-cli","slug":"unable-to-install-packages","errorCode":null,"errorMessage":"Unable to install packages","messagePattern":"Unable to install packages","errorType":"exception","errorClass":"CommandError","httpStatus":null,"severity":"error","filePath":"packages/angular/cli/src/commands/update/cli.ts","lineNumber":598,"sourceCode":"              maxRetries: 3,\n            });\n          } catch (e) {\n            assertIsError(e);\n            if (e.code === 'ENOENT') {\n              task.skip('Cleaning not required. Node modules directory not found.');\n            }\n          }\n        },\n      },\n      {\n        title: 'Installing packages',\n        async task() {\n          try {\n            await packageManager.install({\n              ignorePeerDependencies,\n            });\n          } catch (e) {\n            throw new CommandError('Unable to install packages');\n          }\n        },\n      },\n    ]);\n    try {\n      await tasks.run();\n      // Clear Node's module resolution path cache to prevent stale lookups\n      // when resolving migration package paths.\n      const Module = require('node:module');\n      if (Module && Module._pathCache) {\n        Module._pathCache = Object.create(null);\n      }\n    } catch (e) {\n      if (originalPackageJsonContent !== undefined) {\n        try {\n          await fs.writeFile(packageJsonPath, originalPackageJsonContent, 'utf8');\n          logger.info('Restored package.json to its original state.');\n        } catch (restoreError) {","sourceCodeStart":580,"sourceCodeEnd":616,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular/cli/src/commands/update/cli.ts#L580-L616","documentation":"During `ng update`, the package-install task calls the package manager's install(); any failure (network outage, registry auth, lockfile conflicts, disk issues) is swallowed and rethrown as the generic CommandError 'Unable to install packages', hiding the underlying cause.","triggerScenarios":"packageManager.install({ ignorePeerDependencies }) throws — offline machine, private registry requiring auth, unresolved peer dependency conflicts, corrupted node_modules, or npm/yarn/pnpm CLI errors.","commonSituations":"Corporate proxies/VPNs blocking registry access; missing NPM_TOKEN for @private scopes; partially installed node_modules; incompatible peer dependencies with ignorePeerDependencies=false.","solutions":["Check network/registry access: `npm ping` / verify .npmrc registry and auth tokens.","Run `npm install` (or yarn/pnpm) manually in the workspace to see the real error.","Fix peer dependency conflicts or use --force/--legacy-peer-deps appropriately, then retry ng update.","Delete node_modules and lockfile issues (`rm -rf node_modules package-lock.json`) and retry."],"exampleFix":"// before (private scope without auth)\nng update @myco/ui\n// error: Unable to install packages\n// after: add token to .npmrc\n// @myco:registry=https://npm.myco.io/\n// npm.myco.io/:_authToken=${NPM_TOKEN}\nng update @myco/ui","handlingStrategy":"try-catch","validationCode":"import { execSync } from 'child_process';\nexecSync('npm ping'); // fail fast on registry unavailability before ng update\nexecSync('npm ls --depth=0');","typeGuard":null,"tryCatchPattern":"try {\n  await ngUpdate(packages);\n} catch (e) {\n  if (String(e.message) === 'Unable to install packages') {\n    console.error('ng update hid the real cause; run npm install manually to see it:', e);\n    execSync('npm install --verbose', { stdio: 'inherit' });\n  } else throw e;\n}","preventionTips":["Verify .npmrc registry URL and auth tokens before updating.","Run installs on a reliable network; avoid VPN/proxy outages in CI.","Retry manually with the package manager to surface the underlying error ng update hides."],"tags":["angular","cli","update","npm","network","package-manager"],"backgroundTag":"package-install-failed","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}