Cloudflare
Workers Builds preinstalls Nub. Cloudflare Pages uses the managed-builder devDependency pattern instead.
Cloudflare's Workers Builds image has included Nub since July 30, 2026. Nub runs the build; deployed Workers run on Cloudflare's runtime.
Build settings
The nub binary is on PATH in Workers Builds, so a package script can call nub or nubx with no install step and no devDependency:
{
"scripts": {
"build": "nub run i18n:compile && nubx vite build"
}
}Set Settings → Build → Build command to nub run build. Workers Builds does not read build settings from wrangler.jsonc.
Read the full docs on developers.cloudflare.com.
Letting Nub run the install
Workers Builds installs dependencies before the build command, picking the package manager from the lockfile. It does not recognize nub.lock, so it falls back to another manager and writes a second lockfile, and the next nub install refuses to guess which one owns the project.
Set a build variable so Cloudflare skips its install:
SKIP_DEPENDENCY_INSTALL=trueThen install from the build command:
nub install && nub run buildA project with a pnpm-lock.yaml, package-lock.json, or bun.lock needs neither step. Cloudflare installs with that manager, and Nub reads the same lockfile.
HTTP endpoint
Workers use a fetch handler rather than a Node HTTP server:
export default {
fetch() {
return Response.json({
alive: true,
provider: "cloudflare",
runtime: "cloudflare-workers",
});
},
};Point Wrangler at the handler:
{
"$schema": "node_modules/wrangler/config-schema.json",
"name": "nub-app",
"main": "src/index.ts",
"compatibility_date": "2026-07-30"
}Wrangler bundles the TypeScript handler itself, so this example needs no build command.
Deploy
Connect the repository in the Cloudflare dashboard, where the default deploy command is npx wrangler deploy. To deploy from a workstation:
nubx -y wrangler deploy
curl --fail https://nub-app.ACCOUNT.workers.dev
# {"alive":true,"provider":"cloudflare","runtime":"cloudflare-workers"}Version pinning
Workers Builds provisions its tools with asdf, so a project-root .tool-versions pins Nub and Node together. Nub reads the same file for its own Node.
nodejs 24.18.0
nub 0.11.1A pinned version the image does not carry is downloaded during the build. Without a pin, the image defaults to Node 24.18.0 and also carries Node 22.23.2. A .node-version or .nvmrc file also selects a Node version that both Cloudflare and Nub read.
Adding @nubjs/nub as a devDependency also works, and pins the Nub version in the lockfile.
Pages
The Cloudflare Pages build image does not include Nub (tracking issue). Add the npm package as a devDependency, so the install links both commands into node_modules/.bin:
{
"devDependencies": {
"@nubjs/nub": "^0.11.1"
},
"scripts": {
"build": "nubx vite build"
}
}See Managed builders for the same pattern on other hosted builders.
Read the full docs on developers.cloudflare.com.