Nitro · dependencies

NITRO0028Declare nitro as a peer in packages that import it

Flags published packages whose shipped source imports nitro or a nitro/* subpath without declaring nitro, and packages whose Nitro server code imports nitro while declaring it in dependencies or optionalDependencies instead of peerDependencies.

Why it happens

Consumers do not install a package's devDependencies. A package that imports nitro/h3 or another nitro subpath without declaring nitro works in its own workspace but cannot resolve it under a strict install, and its consumers get no signal about which Nitro it needs. Packages that declare nuxt get Nitro through the Nuxt app that installs them. A package whose code runs in the app's Nitro server and lists nitro in dependencies gets its own copy of nitro when the ranges differ, so nitro/h3 and the other runtime entries resolve to a Nitro the app does not run.

Fix

Declare nitro in peerDependencies with the Nitro 3 range the package supports, and keep it in devDependencies for the package's own build and tests.

Example

Declare the Nitro the package runs on

Before

{ "name": "@acme/blob", "dependencies": { "nitro": "^3.0.0" } }

After

{ "name": "@acme/blob", "peerDependencies": { "nitro": "^3.0.0" }, "devDependencies": { "nitro": "^3.0.0" } }

Verify the fix

Run only this rule after editing so the report stays focused on the diagnostic you are closing:

pnpm vite-doctor . --framework nitro --rules nitro/dependencies/declare-nitro
Copyright © 2026