NextJS - Build completes, but fails on export

Hey there,

I’m trying to deploy my NextJS app to pages. It builds and exports locally and on vercel, but fails on Cloudflare. I get the following error:

I believe all my modules are up to date:

{
  "name": "web",
  "version": "1.0.1",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "next": "^12.2.4",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "swr": "^1.3.0"
  },
  "devDependencies": {
    "@types/node": "^17.0.35",
    "@types/react": "18.0.1",
    "autoprefixer": "^10.4.2",
    "eslint": "8.10.0",
    "eslint-config-next": "12.1.0",
    "postcss": "^8.4.7",
    "tailwindcss": "^3.0.23",
    "typescript": "^4.7.4"
  }
}

Any reason why this might be happening? Thanks!!

1 Like

What is your NODE_VERSION env var set to? By default it’s 12, which is probably too old for your build. Try setting it to 16.

3 Likes

Perfect, that worked! : )

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.