{"record":{"id":"8c9cd1c795e0f96f","repo":"remix-run/react-router","slug":"no-project-directory-provided","errorCode":null,"errorMessage":"No project directory provided","messagePattern":"No project directory provided","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/create-react-router/index.ts","lineNumber":220,"sourceCode":"      color.bold(\"create-react-router\"),\n    )} ${color.bold(`v${ctx.reactRouterVersion}`)}`,\n  );\n\n  if (!ctx.interactive) {\n    log(\"\");\n    info(\"Shell is not interactive.\", [\n      `Using default options. This is equivalent to running with the `,\n      color.reset(\"--yes\"),\n      ` flag.`,\n    ]);\n  }\n}\n\nasync function projectNameStep(ctx: Context) {\n  // valid cwd is required if shell isn't interactive\n  if (!ctx.interactive && !ctx.cwd) {\n    error(\"Oh no!\", \"No project directory provided\");\n    throw new Error(\"No project directory provided\");\n  }\n\n  if (ctx.cwd) {\n    await sleep(100);\n    info(\"Directory:\", [\n      \"Using \",\n      color.reset(ctx.cwd),\n      \" as project directory\",\n    ]);\n  }\n\n  if (!ctx.cwd) {\n    let { name } = await ctx.prompt({\n      name: \"name\",\n      type: \"text\",\n      label: title(\"dir\"),\n      message: \"Where should we create your new project?\",\n      initial: \"./my-react-router-app\",","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/remix-run/react-router/blob/6beaca39526d5716c3c112ebb0782765baa5a9ce/packages/create-react-router/index.ts#L202-L238","documentation":"projectNameStep() requires a project directory whenever the shell is non-interactive (no TTY on stdin). In non-interactive mode the CLI cannot prompt for a directory, so if no positional projectDir argument was given it aborts immediately with this error.","triggerScenarios":"Running create-react-router with no positional argument in CI, Docker, or a piped shell (stdin not a TTY); scripts redirecting stdin from /dev/null; terminal emulators that do not allocate a TTY.","commonSituations":"Dockerfiles, GitHub Actions steps, and smoke tests invoking the CLI without a target directory; automation where isInteractive() is false and --yes is implied.","solutions":["Pass the directory as a positional argument: npx create-react-router ./my-app","In scripts, always include the project directory plus any needed flags (--yes, --no-install, --overwrite)","If you expected the interactive prompt, run the command in a real terminal (TTY attached)"],"exampleFix":"# before (CI, non-interactive)\nnpx create-react-router\n\n# after\nnpx create-react-router ./my-app --yes","handlingStrategy":"validation","validationCode":"function assertScaffoldArgs(argv: string[]): void {\n  const hasPositional = argv.length > 0 && !argv[0].startsWith(\"-\");\n  if (!process.stdin.isTTY && !hasPositional) {\n    throw new Error(\"Non-interactive shell: pass the project directory as a positional argument\");\n  }\n}\n\nassertScaffoldArgs(restArgs);\nawait createReactRouter(restArgs);","typeGuard":null,"tryCatchPattern":"try {\n  await createReactRouter(args);\n} catch (e) {\n  if ((e as Error).message === \"No project directory provided\") {\n    console.error(\"Rerun with a directory: create-react-router ./my-app --yes\");\n    process.exit(1);\n  }\n  throw e;\n}","preventionTips":["Always pass the target directory positionally in scripts, Docker, and CI","Assume --yes behavior whenever stdin is not a TTY","Add a wrapper script that fails fast on missing args before invoking npx"],"tags":["cli","interactive","ci"],"backgroundTag":"missing-required-argument","analyzedSha":"6beaca39526d5716c3c112ebb0782765baa5a9ce","analyzedAt":"2026-08-18T18:04:14.938Z","contentChangedAt":"2026-08-18T18:04:14.938Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}