Skip to content

fix: accept any nitro version in the optional peer dependency - #1106

Merged
antfu merged 2 commits into
nuxt:mainfrom
mansurkhoja:fix/nitro-beta-peer-range
Oct 6, 2026
Merged

antfu merged 2 commits into
nuxt:mainfrom
mansurkhoja:fix/nitro-beta-peer-range

Conversation

@mansurkhoja

@mansurkhoja mansurkhoja commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

The ^3.0.0-0 peer range does not match nitro 3.0.260903-beta. With npm, the nitro that @nuxt/nitro-server needs is then nested under it, nitro@3.0.0 stays at the top of node_modules, and nuxt build fails in a Nuxt 5 project. Details and reproduction in #1105.

This changes the optional nitro peer to * in @nuxt/devtools and @nuxt/devtools-kit. The peer is only used for types, and Nuxt 5 pins the exact Nitro it runs on, so there is no need to follow each Nitro beta. npm treats * as valid without a semver check, so the beta is no longer in conflict. Once Nitro 3 has a stable release, the range can be narrowed to ^3.0.0. The lockfile does not change.

Resolves #1105

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 22fd2af3-7f84-4cfa-a58f-ac4ae1279a8f
📥 Commits

Reviewing files that changed from the base of the PR and between 7f275ee and cc8bd22.

📒 Files selected for processing (2)
  • packages/devtools-kit/package.json
  • packages/devtools/package.json

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

Both @nuxt/devtools and @nuxt/devtools-kit add ^3.0.260903-beta to the Nitro peer dependency range. Both retain ^3.0.0-0.

Priority: ➖ Normal

Estimated code review effort: 1 (Trivial) | ~3 minutes

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to cc8bd

The DevTools packages now accept any Nitro version as an optional peer. This lets npm and pnpm install the current Nitro 3 beta for Nuxt 5 projects without a peer conflict. The change is safe to merge.

Architecture Summary

Architecture risk: 🔵 Low · up to cc8bd

The change affects 2 systems.

Changed systems: packages/devtools, packages/devtools-kit

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — packages/devtools (library) was modified; 1 changed file maps to changed impact.
  • observed — packages/devtools-kit (library) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in packages/devtools-kit/package.json: The optional nitro peer dependency range changes from ^3.0.0-0 to *.
  • observed — Modified behavior in packages/devtools/package.json: The nitro peer dependency range changes from ^3.0.0-0 to *, removing the Nitro 3 prerelease-major restriction.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Issue #1105 requires npm to use the Nitro version required by Nuxt 5 so nuxt build succeeds. The PR changes the optional nitro peer range from ^3.0.0-0 to * in both `packages/devtools/package.…
Out of Scope Changes check ✅ Passed Both changes update only the Nitro peer ranges in the two packages named by issue #1105. They directly support the requested npm resolution fix. No unrelated changes appear in the whole-PR diff.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Title check ✅ Passed The title clearly summarizes the main change: allowing any Nitro version in the optional peer dependency.
Description check ✅ Passed The description explains the Nitro peer range change and its purpose in resolving npm installation and Nuxt build issues.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@antfubot

antfubot commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

Checked the alternatives before suggesting anything looser, and this PR's approach is the only semver-correct one short of *:

  • ^3.0.0-0, >=3.0.0-0 <4 and friends all reject 3.0.260903-beta. semver only lets a prerelease through when the range carries a prerelease on the same major.minor.patch tuple, and npm's peer check is semver.satisfies(version, range, true) (that true is loose, not includePrerelease), so nothing but an explicit ^3.0.<date>-beta member matches a date-stamped beta.
  • * is special-cased by npm (dep-valid.js returns true before calling semver). Since the nitro peer is optional and exists for types — Nuxt 5 pins the exact Nitro it runs on — nitro: "*" would be the zero-maintenance option until Nitro 3 ships a non-prerelease, at which point ^3.0.0 works on its own.

Either is fine for stable; if you keep the per-beta member, a one-line comment in package.json's neighbourhood (or the release checklist) that it needs bumping whenever Nuxt moves to a newer Nitro beta would save the next person the investigation.

(Posted by an agent on behalf of the maintainer.)

@mansurkhoja mansurkhoja changed the title fix: allow nitro 3 beta versions in the peer range fix: accept any nitro version in the optional peer dependency Oct 6, 2026
@mansurkhoja

Copy link
Copy Markdown
Contributor Author

Thanks for checking. I switched to *: the peer is optional and only used for types, so there is nothing to keep in sync with the Nitro betas. I checked an empty Nuxt 5 project (nuxt-nightly 5.0.0-2610052343) with the patched devtools: with *, npm puts nitro@3.0.260903-beta at the top of node_modules and nuxt build passes, and pnpm builds too. Once Nitro 3 has a stable release, the range can be narrowed to ^3.0.0.

@antfu
antfu merged commit f96b08e into nuxt:main Oct 6, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: npm puts nitro@3.0.0 at the top of node_modules and nuxt build fails with Nuxt 5

3 participants