How to Fix: Can’t use –skip-install (or –yes) flags in @ versions for CLI
Next.js CLI flags break when using @version: why –skip-install and –yes stop working and how to fix it
If you run the Next.js starter CLI with an explicit package version like @latest or @canary, flags such as –skip-install and –yes can be misread, ignored, or forwarded incorrectly. The result is confusing behavior: installs happen when they should not, prompts still appear, or the command fails because the CLI argument parser treats part of the command as a package specifier instead of user options.
Understanding the Root Cause
This bug appears when invoking the Next.js CLI through package runners such as npx, npm exec, pnpm dlx, or similar tools while also attaching an explicit @version suffix to the package name.
A command like this looks harmless:
npx create-next-app@canary my-app --skip-install --yes
But there are actually two layers of argument parsing happening:
- The package runner parses the package specifier and decides what to download and execute.
- The CLI itself parses the remaining arguments such as –skip-install and –yes.
When a package is referenced as create-next-app@canary, some combinations of runner behavior, shell handling, and internal CLI parsing can cause flags to be interpreted at the wrong stage. In practice, the CLI may not reliably receive those flags in the same way it does when no explicit version is attached.
This is why the issue is more visible with commands that use @latest, @canary, or another tagged version. The package runner focuses on resolving the versioned package, and the downstream argument forwarding becomes fragile. On Linux environments such as Linux Mint with Bash and Node.js v20, this can be reproduced consistently depending on the exact runner used.
In short, the root cause is not that –skip-install or –yes are invalid flags. The problem is that the version-qualified executable invocation path changes how arguments are passed to the underlying Next.js scaffolding command.
Step-by-Step Solution
The safest fix is to use a command form that makes the package resolution and the CLI arguments unambiguous.
1. Prefer npm create syntax when possible
This is often the cleanest workaround because it separates the initializer from its arguments more predictably.
npm create next-app@latest my-app -- --skip-install --yes
For canary:
npm create next-app@canary my-app -- --skip-install --yes
The standalone — tells the package runner to stop parsing and forward everything after it directly to the Next.js CLI.
2. Use npx with explicit argument forwarding
If you prefer npx, use a form that clearly separates package execution from CLI flags.
npx create-next-app@latest my-app -- --skip-install --yes
npx create-next-app@canary my-app -- --skip-install --yes
If your environment still behaves inconsistently, switch to npm create, which tends to be more reliable for initializers.
3. Verify that the flags were actually applied
After running the command:
- If –skip-install worked, dependencies should not be installed automatically.
- If –yes worked, the CLI should avoid interactive confirmation prompts and use defaults where applicable.
You can confirm by checking whether a dependency install started immediately or whether prompts were skipped.
4. Fallback workaround: run interactively, then install manually
If your runner still ignores flags for the versioned command, use the initializer without those flags and control the remaining steps yourself.
npx create-next-app@canary my-app
Then, if you want to delay dependency installation, remove the generated directory and retry with a more reliable runner, or scaffold in an environment where argument forwarding is known to work correctly.
5. Use an alternative runner if your toolchain supports it
Some developers get more predictable results from pnpm dlx or bunx, but the same argument-boundary rule still applies: explicitly separate runner arguments from CLI arguments.
pnpm dlx create-next-app@canary my-app -- --skip-install --yes
bunx create-next-app@canary my-app -- --skip-install --yes
The key fix is always the same: force a clear delimiter so the flags reach the actual Next.js CLI instead of being consumed or misinterpreted earlier.
Recommended command summary
npm create next-app@canary my-app -- --skip-install --yes
That is the most practical workaround for this issue until the CLI and runner interaction is fully normalized.
Common Edge Cases
1. The command still installs dependencies
If installation still starts automatically, your shell or runner may not be forwarding arguments after the package specifier as expected. Try switching from npx to npm create or pnpm dlx.
2. –yes skips some prompts but not all
Some prompts may be tied to conditions not fully covered by default-answer logic, especially across canary builds. This is more likely on pre-release versions where CLI behavior is still changing.
3. Quoting the package specifier incorrectly
If you wrap the entire executable reference in unusual quoting or alias it through a shell function, the command can behave differently. Keep the invocation simple and avoid custom wrappers while testing.
4. Using cached older package data
Your local tool may reuse a cached package copy. If behavior seems inconsistent, clear your package runner cache or rerun in a clean environment.
npm cache clean --force
Then retry the command.
5. Confusing create-next-app with project dependencies
This issue affects the scaffolding executable, not the Next.js runtime inside your generated app. Updating the app’s next dependency alone will not fix CLI argument forwarding.
6. Shell-specific parsing differences
Although the reported environment is Bash, different shells can handle separators and escaping differently. If a team shares scripts across environments, verify that the command works in each shell rather than assuming identical behavior.
FAQ
Why do the flags work without @canary or @latest but fail with them?
Because adding @version changes how the package runner resolves and executes the CLI package. That extra resolution step can interfere with how flags are forwarded unless you explicitly separate them with —.
Is this a Next.js bug or an npm/npx bug?
It is best understood as an interaction bug between the Next.js initializer and the package execution layer. The symptoms appear in the Next.js CLI workflow, but the root problem involves how the runner and the CLI split responsibility for parsing arguments.
What is the safest command to use right now?
The most reliable workaround is:
npm create next-app@canary my-app -- --skip-install --yes
This makes the boundary between the initializer package and the forwarded CLI options explicit.
If you want to track future fixes, monitor the relevant Next.js issue tracker and test again with newer canary releases.