Runtimes

Deno

使用 Deno 运行时运行 Nitro 应用。

预设:deno_server

¥Preset: deno_server

你可以使用 Node.js 构建 Nitro 服务器,并在自定义服务器中在 Deno 运行时 内运行。

¥You can build your Nitro server using Node.js to run within Deno Runtime in a custom server.

# Build with the deno NITRO preset
NITRO_PRESET=deno_server npm run build

# Start production server
deno run --unstable --allow-net --allow-read --allow-env .output/server/index.ts

要启用 Node.js 兼容性,你需要升级到 Deno v2,并在 nitro 配置文件中将兼容日期设置为 2025-01-30 或更高版本。

¥To enabling Node.js compatibility, you need to upgrade to Deno v2, and a compatibility date set to 2025-01-30 or later in your nitro configuration file.

export default defineNitroConfig({
    compatibilityDate: "2025-01-30",
})

Deno 部署

¥Deno Deploy

Read more in Deploy > Providers > Deno Deploy.