Skip to content

Conversation

@kt3k
Copy link

@kt3k kt3k commented Nov 26, 2025

This PR adds --use-deno option to create-next-app. Also detects deno by npm_config_user_agent env var (Deno implements it since v2.1 denoland/deno#26639 ).

A previous attempt #71396

@ijjk ijjk added create-next-app Related to our CLI tool for quickly starting a new Next.js application. Documentation Related to Next.js' official documentation. tests labels Nov 26, 2025
@ijjk
Copy link
Member

ijjk commented Nov 26, 2025

Allow CI Workflow Run

  • approve CI run for commit: 3edbba9

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

yarn: 'yarn global add create-next-app',
pnpm: 'pnpm add -g create-next-app',
bun: 'bun add -g create-next-app',
deno: 'deno i -g npm:create-next-app',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Deno update command is incorrect. Deno does not have an i subcommand (the install command is install, not i), and this approach doesn't work for npm packages. Based on the README showing deno -A npm:create-next-app@latest, the correct command should be:

deno: 'deno run -A npm:create-next-app@latest'

The current command deno i -g npm:create-next-app will fail when users try to update, showing them an invalid command.

Suggested change
deno: 'deno i -g npm:create-next-app',
deno: 'deno run -A npm:create-next-app@latest',

Spotted by Graphite Agent

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deno i does exist, which is an alias of deno install. You can check that with deno i -h

Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Suggestion:

The command instructions printed for Deno users are incorrect. They show invalid Deno commands like deno run dev, deno run build, and deno start.

View Details
📝 Patch Details
diff --git a/packages/create-next-app/create-app.ts b/packages/create-next-app/create-app.ts
index 165717ff57..c340e30c60 100644
--- a/packages/create-next-app/create-app.ts
+++ b/packages/create-next-app/create-app.ts
@@ -148,6 +148,7 @@ export async function createApp({
   }
 
   const useYarn = packageManager === 'yarn'
+  const useDeno = packageManager === 'deno'
   const isOnline = !useYarn || (await getOnline())
   const originalDirectory = process.cwd()
 
@@ -275,19 +276,19 @@ export async function createApp({
   if (hasPackageJson) {
     console.log('Inside that directory, you can run several commands:')
     console.log()
-    console.log(cyan(`  ${packageManager} ${useYarn ? '' : 'run '}dev`))
+    console.log(cyan(`  ${packageManager} ${useYarn ? '' : useDeno ? 'task ' : 'run '}dev`))
     console.log('    Starts the development server.')
     console.log()
-    console.log(cyan(`  ${packageManager} ${useYarn ? '' : 'run '}build`))
+    console.log(cyan(`  ${packageManager} ${useYarn ? '' : useDeno ? 'task ' : 'run '}build`))
     console.log('    Builds the app for production.')
     console.log()
-    console.log(cyan(`  ${packageManager} start`))
+    console.log(cyan(`  ${packageManager} ${useDeno ? 'task ' : ''}start`))
     console.log('    Runs the built app in production mode.')
     console.log()
     console.log('We suggest that you begin by typing:')
     console.log()
     console.log(cyan('  cd'), cdpath)
-    console.log(`  ${cyan(`${packageManager} ${useYarn ? '' : 'run '}dev`)}`)
+    console.log(`  ${cyan(`${packageManager} ${useYarn ? '' : useDeno ? 'task ' : 'run '}dev`)}`)
   }
   console.log()
 }

Analysis

Incorrect Deno command instructions in create-next-app

What fails: The printed command instructions for Deno users show deno run dev, deno run build, and deno start instead of the correct deno task dev, deno task build, and deno task start.

How to reproduce:

deno run -A npm:create-next-app my-app
# When prompts appear, create a default Next.js app with Deno as the package manager
# At the end, observe the printed instructions

Result: The output instructions show:

deno run dev
deno run build
deno start

Expected: According to Deno's official documentation for running Next.js, and Deno's package.json compatibility documentation, the correct commands should be:

deno task dev
deno task build
deno task start

The Deno documentation explicitly states: "Deno supports running npm scripts natively with the deno task subcommand (If you're migrating from Node.js, this is similar to the npm run script command)."

Fix: Modified packages/create-next-app/create-app.ts to:

  1. Add useDeno flag to detect when Deno is the package manager
  2. Updated command display logic to use deno task for dev, build, and start commands when packageManager is 'deno'
Fix on Vercel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

create-next-app Related to our CLI tool for quickly starting a new Next.js application. Documentation Related to Next.js' official documentation. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants