next.js
254065b6 - create-next-app: exit with code 1 when installation fails (#101624)

Commit
13 days ago
create-next-app: exit with code 1 when installation fails (#101624) ## Summary When dependency installation fails, `create-next-app` prints `Aborting installation. <pm> install has failed.` but exits with code **0**. Scripts and CI calling `create-next-app` therefore see a false success. `exit()` awaited `notifyUpdate()`, which unconditionally called `process.exit(0)`, so the following `process.exit(1)` was unreachable. `notifyUpdate()` no longer exits. The success path now exits with `0` explicitly after the update notice, and the failure path exits with `1`. This surfaced in a canary CI failure of `test/production/create-next-app/templates/pages.test.ts`. A transient `npm ERR! code ETARGET` during install (an upstream package release published non-atomically) was reported as `missing expected file node_modules/next` instead of failing the `exitCode` assertion, because CNA exited 0. ## Verification - New test `should exit with a non-zero code when dependency installation fails` in `test/production/create-next-app/index.test.ts`. It installs from a missing local tarball, so it needs no network. - Before the fix: fails (`Expected: 1, Received: 0`). - After the fix: passes 3/3. - `NEXT_TEST_MODE=start IS_WEBPACK_TEST=1 node run-tests.js --retries 0 --runs 3 -c 1 test/production/create-next-app/index.test.ts`: 3/3 passed. - `test/production/create-next-app/templates/pages.test.ts` (success path, exit 0) still passes with a warm npm cache. <!-- NEXT_JS_LLM --> <!-- fleet 83161c8d-1b49-450a-a6a0-1c42639e58ff --> Co-authored-by: vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>
Author
Parents
Loading