nextjs - 💡(How to fix) Fix create-next-app hangs in non-interactive environments (CI/CD, AI tools) [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#91168Fetched 2026-04-08 00:18:50
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
closed ×1commented ×1labeled ×1locked ×1

Error Message

if (!process.stdin.isTTY && requiresUserInput(args)) { console.error('Error: Interactive prompts not available'); console.error('For automation, use: npx create-next-app my-app --yes'); process.exit(1); }

Root Cause

create-next-app hangs indefinitely when run in CI/CD, Docker, or by AI coding tools (Claude, Copilot, ChatGPT) because it waits for interactive input that never comes.

Code Example

# In GitHub Actions or when Claude runs this:
npx create-next-app@latest my-app --typescript --tailwind

# Result: hangs forever, no error message

---

if (!process.stdin.isTTY && requiresUserInput(args)) {
  console.error('Error: Interactive prompts not available');
  console.error('For automation, use: npx create-next-app my-app --yes');
  process.exit(1);
}
RAW_BUFFERClick to expand / collapse

Problem

create-next-app hangs indefinitely when run in CI/CD, Docker, or by AI coding tools (Claude, Copilot, ChatGPT) because it waits for interactive input that never comes.

Current behavior

# In GitHub Actions or when Claude runs this:
npx create-next-app@latest my-app --typescript --tailwind

# Result: hangs forever, no error message

Proposed fix

Detect when stdin isn't a TTY and fail fast with a helpful message:

if (!process.stdin.isTTY && requiresUserInput(args)) {
  console.error('Error: Interactive prompts not available');
  console.error('For automation, use: npx create-next-app my-app --yes');
  process.exit(1);
}

Why this helps

  • Self-teaching: Error message shows the right flags
  • Works everywhere: CI/CD, Docker, AI tools all benefit
  • Standard pattern: Same approach as npm, yarn, pnpm
  • Zero breaking changes: Only adds error handling

Related issues

  • #56569 - Import alias prompts even with flags
  • #62494 - --src-dir and --app still prompt
  • #48125 - Tailwind breaks Docker CI/CD

extent analysis

Problem Summary

create-next-app blocks forever in non‑interactive environments (CI, Docker, AI‑driven runs) because it still tries to show prompts even when stdin isn’t a TTY.

Root Cause

The CLI always assumes it can ask the user for missing options. When process.stdin.isTTY === false the prompts never receive input, so the process hangs.

Fix Plan

  1. Add early TTY guard
    In the entry point (usually src/cli.ts or index.ts) insert a check before any prompt logic.

  2. Expose a --yes / -y flag
    Treat it as “accept defaults, no prompts”. This already exists in many CLIs; make sure it short‑circuits the prompt flow.

  3. Show a helpful error when prompts are required but impossible
    If the user didn’t pass --yes and the CLI still needs input, abort with a clear message.

  4. Update documentation & README
    Add a “Running in CI / Docker” section that tells users to add --yes.

  5. Add a unit test to guarantee the guard works.

1. Code change (TypeScript)

// src/cli.ts (or wherever the main function lives)

import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
import { runCreateNextApp } from './create-next-app';

// Helper to decide if we will need interactive input later
function requiresUserInput(argv: any): boolean {
  // any option that is still undefined after parsing means we would prompt for it
  const needed = ['app', 'srcDir', 'tailwind', 'eslint', 'importAlias'];
  return needed.some((key) => argv[key] === undefined);
}

// Parse flags first – this must happen before any prompt library is imported
const argv = yargs(hideBin(process.argv))
  .option('yes', {
    alias: 'y',
    type: 'boolean',
    description: 'Accept defaults and skip all prompts',
    default: false,
  })
  .option('typescript', { type: 'boolean' })
  .option('tailwind', { type: 'boolean' })
  // … other flags …
  .parseSync();

// 1️⃣ TTY guard
if (!process.stdin.isTTY && !argv.yes) {
  if (requiresUserInput(argv)) {
    console.error('\n❌

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

nextjs - 💡(How to fix) Fix create-next-app hangs in non-interactive environments (CI/CD, AI tools) [1 comments, 2 participants]