Nitro v3 introduces intentional backward-incompatible changes. This guide helps you migrate from Nitro v2.
nitropack is renamed to nitroThe NPM package nitropack (v2) has been renamed to nitro (v3).
Migration: Update the nitropack dependency to nitro in package.json:
{
"dependencies": {
-- "nitropack": "latest"
++ "nitro": "latest"
}
}
{
"dependencies": {
-- "nitropack": "latest"
++ "nitro": "npm:nitro-nightly"
}
}
Migration: Search your codebase and rename all instances of nitropack to nitro:
-- import { defineNitroConfig } from "nitropack/config"
++ import { defineNitroConfig } from "nitro/config"
Runtime utils had been moved to individual nitro/* subpath exports. Refer to docs for usage.
-- import { useStorage } from "nitropack/runtime/storage"
++ import { useStorage } from "nitro/storage"
Nitro now requires a minimum Node.js version of 20, as Node.js 18 reaches end-of-life in April 2025.
Please upgrade to the latest LTS version (>= 20).
Migration:
node --version and update if necessary.Nitro types are now only exported from nitro/types.
Migration: Import types from nitro/types instead of nitro:
-- import { NitroRuntimeConfig } from "nitropack"
++ import { NitroRuntimeConfig } from "nitro/types"
Nitro v2 supported a bundled app config that allowed defining configurations in app.config.ts and accessing them at runtime via useAppConfig().
This feature had been removed.
Migration:
Use a regular .ts file in your server directory and import it directly.
Nitro presets have been updated for the latest compatibility.
Some (legacy) presets have been removed or renamed.
| Old Preset | New Preset |
|---|---|
node | node-middleware (export changed to middleware) |
cloudflare, cloudflare_worker, cloudflare_module_legacy | cloudflare_module |
deno-server-legacy | deno_server with Deno v2 |
netlify-builder | netlify_functions or netlify_edge |
vercel-edge | vercel with Fluid compute enabled |
azure, azure_functions | azure_swa |
firebase | firebase-functions |
iis | iis-handler |
deno | deno-deploy |
edgio | Discontinued |
cli | Removed due to lack of use |
service_worker | Removed due to instability |
firebase | Use new firebase app hosting |
Nitro v2 introduced multiple subpath exports, some of which have been removed or updated:
nitro/rollup, nitropack/core (use nitro/builder)nitropack/runtime/* (use nitro/*)nitropack/kit (removed)nitropack/presets (removed)An experimental nitropack/kit was introduced but has now been removed. A standalone Nitro Kit package may be introduced in the future with clearer objectives.
Migration:
NitroModule from nitro/types instead of defineNitroModule from the kit.If you were using useNitroApp().hooks outside of Nitro plugins before, it might be undefined. Use new useNitroHooks() to guarantee having an instance.