{"record":{"id":"aa05609c9252b8cf","repo":"can1357/oh-my-pi","slug":"install-of-release-packages-pkg-failed-with-exi","errorCode":null,"errorMessage":"install of ${release.packages.pkg} failed with exit code ${installExit}; the existing install was left untouched","messagePattern":"install of (.+?) failed with exit code (.+?); the existing install was left untouched","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/cli/update-cli.ts","lineNumber":1483,"sourceCode":"}\n\n/**\n * Migrate a package-manager install across an `omp.rename` hop without a\n * window where no working `omp` exists:\n *\n * 1. Install the new package FIRST. Nothing has been removed yet, so a\n *    failure here leaves the old install fully functional.\n * 2. Remove the old-name globals. Failure is non-fatal: a stale package\n *    wastes disk, but the bin already points at the new install.\n * 3. Verify the PATH-resolved `omp`. If the removal deleted the shared bin\n *    link (manager-dependent), re-run the idempotent install to restore it\n *    and verify again; only a repeated failure aborts, with a recovery hint.\n */\nexport async function migrateRenamedInstall(release: ReleaseInfo, steps: RenameMigrationSteps): Promise<void> {\n\tconsole.log(chalk.dim(`npm package renamed to ${release.packages.pkg}; migrating this install.`));\n\tconst installExit = await steps.install();\n\tif (installExit !== 0) {\n\t\tthrow new Error(\n\t\t\t`install of ${release.packages.pkg} failed with exit code ${installExit}; the existing install was left untouched`,\n\t\t);\n\t}\n\n\tconst removeExit = await steps.removeOld();\n\tif (removeExit !== 0) {\n\t\tconsole.log(chalk.yellow(`Warning: could not remove the old ${PACKAGE} package; remove it manually later.`));\n\t}\n\n\tlet verification = await steps.verify();\n\tif (!verification.ok) {\n\t\t// Removing the old package may have taken the shared bin link with it;\n\t\t// reinstalling the new package restores the link.\n\t\tif ((await steps.install()) === 0) {\n\t\t\tverification = await steps.verify();\n\t\t}\n\t}\n\tif (!verification.ok) {","sourceCodeStart":1465,"sourceCodeEnd":1501,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/cli/update-cli.ts#L1465-L1501","documentation":"Thrown by `migrateRenamedInstall` when the npm package has been renamed and the migration's install step (installing the new package name) exits with a non-zero code. The updater aborts deliberately without touching the existing working install.","triggerScenarios":"`steps.install()` (e.g. `npm install -g <new-pkg>` run as a subprocess) returns a non-zero exit code during the rename migration flow.","commonSituations":"npm permissions issues (EACCES on the global prefix), registry auth required for the new package, no network, npm not on PATH in the migration environment, or disk full.","solutions":["Run the install step manually to see the real npm error: npm install -g <new-pkg>","Fix npm global prefix permissions (use a user-owned prefix or nvm/volta-managed node)","Ensure the registry is reachable and any required auth (npm login) is set up","After fixing, re-run `omp update` which will retry the migration; the old install is intact"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// verify npm can install globally before starting the migration\nnpm ping && npm config get prefix","typeGuard":null,"tryCatchPattern":"try {\n  await runUpdate();\n} catch (err) {\n  if (String(err?.message).includes(\"failed with exit code\")) {\n    console.error(\"Migration install failed; existing install untouched. Run `npm install -g <new-pkg>` manually to see the error.\");\n    return;\n  }\n  throw err;\n}","preventionTips":["Ensure `npm` is on PATH and `npm ping` succeeds before updating","Use a user-writable global prefix (nvm/volta) to avoid EACCES","Log in to the registry if the new package requires auth","Free disk space before large global installs"],"tags":["npm","rename-migration","installation","updater"],"backgroundTag":"npm-install-failed","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}