Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

create-next-app keeps creating a TypeScript project

ErrorWould you like to use the recommended Next.js defaults?

Short answer

create-next-app now makes a TypeScript project by default. Answering Yes to the recommended defaults picks TypeScript, and --yes reuses your stored preferences. Pass --js on the command line, choose customize settings and answer No to TypeScript, or reset the saved preferences with --reset-preferences.

  • Applies to create-next-app for Next.js 15 and 16, Node.js 22, npm 10
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Run the command with --help to see which flags your installed version knows, then create the project with the JavaScript flag.

    npx create-next-app@latest --help
    npx create-next-app@latest my-app --js
  2. 2Match what you see, then jump to its fix

    1. 1You pressed Enter on the first question, and the project came out with .tsx files.The recommended defaults include TypeScriptFix
    2. 2No question about TypeScript appears at all, for example after copying the quick start command that ends in --yes.Stored preferences or --yes answer for youFix

What does the error look like?

  • Would you like to use the recommended Next.js defaults?
  • Would you like to use TypeScript? No / Yes

Cause 1 of 2

The recommended defaults include TypeScript

1Check

The first prompt offers recommended defaults that start with TypeScript. The customize path asks the TypeScript question on its own.

ls my-app/app

2Fix

Create the project again and choose the customize option, then answer No to TypeScript. Or pass the flag so no question is asked.

npx create-next-app@latest my-app --js

3Verify

The new project has JavaScript files in app, such as layout.js and page.js, not .tsx files.

ls my-app/app

Confirmed by nextjs.org

Did this fix it?

Cause 2 of 2

Stored preferences or --yes answer for you

1Check

The docs say --yes skips the prompts and uses saved preferences or defaults, and the default setup enables TypeScript. There is also a flag to reset stored preferences.

npx create-next-app@latest --help

2Fix

Reset the stored preferences, then ask for JavaScript explicitly.

npx create-next-app@latest my-app --reset-preferences --js

3Verify

The prompts appear again, or the project is created with JavaScript files.

ls my-app/app

Confirmed by nextjs.org

Did this fix it?

How do I stop it coming back?

  • Write the project command in your notes with --js spelled out.
  • Run --help after a major Next.js update; defaults change between versions.
  • Skip --yes on a shared machine, since it reuses whatever was saved before.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Back end

cdk synth says --app is required

--app is required either in command-line, in cdk.json or in ~/.cdk.json

The CDK CLI needs a command that runs your app and finds it in three places: the --app option, cdk.json in the project folder, or cdk.json in your home folder.

3 causes, each with a fix

Back end

Mocha or Node cannot find ts-node/register

Error: Cannot find module 'ts-node/register'

Node resolves ts-node/register from your project's node_modules, so the package must be installed there, next to typescript.

2 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.