# Cloudflare Pages: Build failed — Node.js version not supported / npm ERR! (build command exited with code 1)

**Code:** `Pages build failed` · **Category:** Cloudflare · **Seen on:** Cloudflare Pages

The Pages build environment could not build the project.

## Meaning

Pages uses a fixed default Node version and package manager. A framework needing newer Node, a missing lockfile, or env variables set only locally make builds fail even when they work locally.

## Common causes

- Node version too old for the framework
- Environment variables missing in Pages settings
- Wrong build command or output directory
- Lockfile mismatch (npm vs pnpm vs yarn)

## Quick fix

1. Set `NODE_VERSION` (and `PNPM_VERSION`) as environment variables
2. Add production env vars in the dashboard
3. Match the build command and output directory to the framework

## Detailed fix by platform

### Pages settings

1. Environment variables → `NODE_VERSION = 20`; Build command `npm run build`; Output `dist`

## How to diagnose

1. **Log** — First error line?
2. **Node** — Version?
3. **Env** — Variables set?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/cloudflare/pages-build-failed-node-version)
