{"record":{"id":"ba14133713f27437","repo":"withastro/astro","slug":"process-exited-with-code-exitcode-ba1413","errorCode":null,"errorMessage":"Process exited with code ${exitCode}","messagePattern":"Process exited with code (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/upgrade/src/shell.ts","lineNumber":75,"sourceCode":"\t\t\tcwd: opts.cwd,\n\t\t\tstdio: opts.stdio,\n\t\t\ttimeout: opts.timeout,\n\t\t});\n\t\tconst done = new Promise<void>((resolve, reject) => {\n\t\t\tchild.once('error', reject);\n\t\t\tchild.once('close', () => resolve());\n\t\t});\n\t\t[stdout, stderr] = await Promise.all([text(child.stdout), text(child.stderr), done]);\n\t} catch (e) {\n\t\tconst message = e instanceof Error ? e.message : stderr || 'Unknown error';\n\t\tthrow new Error(message);\n\t}\n\tconst { exitCode } = child;\n\tif (exitCode === null) {\n\t\tthrow new Error('Timeout');\n\t}\n\tif (exitCode !== 0) {\n\t\tthrow new Error(stderr || stdout || `Process exited with code ${exitCode}`);\n\t}\n\treturn { stdout, stderr, exitCode };\n}\n","sourceCodeStart":57,"sourceCodeEnd":79,"githubUrl":"https://github.com/withastro/astro/blob/52e6c34790cc8ac4e69e6135ace06049867e5c4a/packages/upgrade/src/shell.ts#L57-L79","documentation":"`shell()` in @astrojs/upgrade throws when a spawned command exits with a non-zero code. The message prefers the captured stderr (then stdout) of the child, so the error text you see is usually the underlying package-manager output (e.g. `npm ERR! ...`); the literal \"Process exited with code N\" appears only when the command produced no output at all.","triggerScenarios":"`astro upgrade` runs `npm/pnpm/yarn/bun install` or `update` under the hood and it fails: ERESOLVE peer-dependency conflicts, missing registry auth, invalid package.json, lockfile out of sync, or the package manager binary itself erroring.","commonSituations":"Peer-dependency conflicts between the new Astro version and other deps (most common); corrupted lockfiles after switching package managers; private registry credentials expired mid-run; monorepo hoisting conflicts.","solutions":["Read the embedded npm/pnpm error in the message — it names the conflicting packages","Reproduce manually with the same command (e.g. `npm install astro@latest`) to see the full output","Fix the reported peer conflict by upgrading the conflicting package too, or pin compatible versions","If the lockfile is the problem, regenerate it (delete lockfile + node_modules) and retry"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await runUpgrade();\n} catch (e) {\n  if (e instanceof Error && /npm ERR!|ERESOLVE|process exited with code/i.test(e.message)) {\n    // run the same install manually to see full output and fix the conflict\n  }\n  throw e;\n}","preventionTips":["Resolve peer-dependency warnings before major upgrades","Keep one package manager per repo; don't mix lockfiles","Read the embedded stderr in the thrown message — it identifies the failing command"],"tags":["upgrade","child-process","package-manager","exit-code"],"backgroundTag":"command-exit-nonzero","analyzedSha":"52e6c34790cc8ac4e69e6135ace06049867e5c4a","analyzedAt":"2026-08-18T18:48:03.901Z","contentChangedAt":"2026-08-18T18:48:03.901Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}