ENOSPC: no space left on device - in cloudflare workers when deploying next.js app

For Workers & Pages, what is the name of the domain?

nmdrp.xyz

What is the error message?

ENOSPC: no space left on device

What is the issue or error you’re encountering

'm getting this error ENOSPC: no space left on device - in cloudflare workers

What steps have you taken to resolve the issue?

I purchased workers paid plan to check if it will solve the issue but it didn’t - I still get this issue
i have checked the bundle size: client bundle size is 3.27mb and node.js is 3.25 mb

What are the steps to reproduce the issue?

make a change in your project and then push to github or gitlab ( in my case i’m using gitlab )
when it builds it will give you this error


16:26:59.356 node:fs:3004
16:26:59.356 binding.copyFile(
16:26:59.356 ^
16:26:59.356
16:26:59.356 Error: ENOSPC: no space left on device, copyfile ‘/opt/buildhome/repo/apps/nd-web-home-next.js/.next/cache/webpack/client-production/0.pack’ → ‘/opt/buildhome/repo/apps/nd-web-home-next.js/.open-next/.next/cache/webpack/client-production/0.pack’
16:26:59.356 at copyFileSync (node:fs:3004:11)
16:26:59.356 at copyFile (node:internal/fs/cp/cp-sync:104:3)
16:26:59.357 at onFile (node:internal/fs/cp/cp-sync:83:25)
16:26:59.357 at getStats (node:internal/fs/cp/cp-sync:72:12)
16:26:59.357 at copyDir (node:internal/fs/cp/cp-sync:170:9)
16:26:59.357 at mkDirAndCopy (node:internal/fs/cp/cp-sync:145:3)
16:26:59.357 at onDir (node:internal/fs/cp/cp-sync:139:25)

It looks like your computer may be low on disk space. What’s the output of df -h /?

@lunorian this error shows up on the build logs of the build worker not the local computer. I am also seeing this issue with opennextjs

2025-01-14T00:43:39.073Z	Initializing build environment...
2025-01-14T00:43:48.876Z	Success: Finished initializing build environment
2025-01-14T00:43:49.569Z	Cloning repository...
2025-01-14T00:43:52.179Z	Detected the following tools from environment: [email protected], [email protected], [email protected]
2025-01-14T00:43:52.179Z	Installing nodejs 22.13.0
2025-01-14T00:43:57.341Z	Installing project dependencies: yarn
2025-01-14T00:43:57.519Z	! Corepack is about to download https://registry.yarnpkg.com/yarn/-/yarn-1.22.22.tgz
2025-01-14T00:43:58.229Z	yarn install v1.22.22
2025-01-14T00:43:58.326Z	warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
2025-01-14T00:43:58.330Z	[1/5] Validating package.json...
2025-01-14T00:43:58.333Z	[2/5] Resolving packages...
2025-01-14T00:43:58.818Z	[3/5] Fetching packages...
2025-01-14T00:44:53.302Z	warning [email protected]: The engine "bun" appears to be invalid.
2025-01-14T00:44:53.303Z	warning [email protected]: The engine "deno" appears to be invalid.
2025-01-14T00:44:53.304Z	warning @ecies/[email protected]: The engine "bun" appears to be invalid.
2025-01-14T00:44:53.304Z	warning @ecies/[email protected]: The engine "deno" appears to be invalid.
2025-01-14T00:44:53.338Z	[4/5] Linking dependencies...
2025-01-14T00:44:53.377Z	warning Workspaces can only be enabled in private projects.
2025-01-14T00:44:53.386Z	warning Workspaces can only be enabled in private projects.
2025-01-14T00:45:15.140Z	[5/5] Building fresh packages...
2025-01-14T00:45:15.858Z	Done in 77.63s.
2025-01-14T00:45:15.920Z	Executing user build command: npx opennextjs-cloudflare
2025-01-14T00:45:17.299Z	
2025-01-14T00:45:17.299Z	┌─────────────────────────────┐
2025-01-14T00:45:17.300Z	│ OpenNext — Cloudflare build │
2025-01-14T00:45:17.300Z	└─────────────────────────────┘
2025-01-14T00:45:17.300Z	
2025-01-14T00:45:17.407Z	App directory: /opt/buildhome/repo
2025-01-14T00:45:17.408Z	Next.js version : 14.2.20
2025-01-14T00:45:17.408Z	OpenNext v3.3.0
2025-01-14T00:45:17.408Z	
2025-01-14T00:45:17.408Z	┌─────────────────────────────────┐
2025-01-14T00:45:17.408Z	│ OpenNext — Building Next.js app │
2025-01-14T00:45:17.408Z	└─────────────────────────────────┘
2025-01-14T00:45:17.408Z	
2025-01-14T00:45:17.585Z	
2025-01-14T00:45:17.586Z	> @minimal-kit/[email protected] build
2025-01-14T00:45:17.586Z	> next build
2025-01-14T00:45:17.586Z	
2025-01-14T00:45:18.285Z	⚠ No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
2025-01-14T00:45:18.322Z	Attention: Next.js now collects completely anonymous telemetry regarding usage.
2025-01-14T00:45:18.322Z	This information is used to shape Next.js' roadmap and prioritize features.
2025-01-14T00:45:18.323Z	You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
2025-01-14T00:45:18.323Z	https://nextjs.org/telemetry
2025-01-14T00:45:18.323Z	
2025-01-14T00:45:18.447Z	  ▲ Next.js 14.2.20
2025-01-14T00:45:18.447Z	  - Environments: .env
2025-01-14T00:45:18.447Z	
2025-01-14T00:45:18.465Z	   Creating an optimized production build ...
2025-01-14T00:45:58.971Z	<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: ENOSPC: no space left on device, write
2025-01-14T00:45:58.982Z	 ✓ Compiled successfully
2025-01-14T00:45:58.983Z	   Linting and checking validity of types ...
2025-01-14T00:46:36.179Z	Failed to compile.
2025-01-14T00:46:36.180Z	
2025-01-14T00:46:36.181Z	Type error: Could not write file '/opt/buildhome/repo/.next/cache/.tsbuildinfo': ENOSPC: no space left on device, write.
2025-01-14T00:46:36.181Z	
2025-01-14T00:46:36.463Z	node:internal/errors:983
2025-01-14T00:46:36.463Z	  const err = new Error(message);
2025-01-14T00:46:36.463Z	              ^
2025-01-14T00:46:36.463Z	
2025-01-14T00:46:36.463Z	Error: Command failed: npm run build
2025-01-14T00:46:36.463Z	    at genericNodeError (node:internal/errors:983:15)
2025-01-14T00:46:36.463Z	    at wrappedFn (node:internal/errors:537:14)
2025-01-14T00:46:36.463Z	    at checkExecSyncError (node:child_process:882:11)
2025-01-14T00:46:36.463Z	    at Object.execSync (node:child_process:954:15)
2025-01-14T00:46:36.463Z	    at buildNextjsApp (file:///opt/buildhome/repo/node_modules/@opennextjs/aws/dist/build/buildNextApp.js:15:8)
2025-01-14T00:46:36.463Z	    at build (file:///opt/buildhome/repo/node_modules/@opennextjs/cloudflare/dist/cli/build/index.js:50:9)
2025-01-14T00:46:36.463Z	    at async file:///opt/buildhome/repo/node_modules/@opennextjs/cloudflare/dist/cli/index.js:7:1 {
2025-01-14T00:46:36.464Z	  status: 1,
2025-01-14T00:46:36.464Z	  signal: null,
2025-01-14T00:46:36.464Z	  output: [ null, null, null ],
2025-01-14T00:46:36.464Z	  pid: 1404,
2025-01-14T00:46:36.464Z	  stdout: null,
2025-01-14T00:46:36.464Z	  stderr: null
2025-01-14T00:46:36.464Z	}
2025-01-14T00:46:36.464Z	
2025-01-14T00:46:36.464Z	Node.js v22.13.0
2025-01-14T00:46:36.530Z	Failed: error occurred while running build command

It looks like your build script is exhausting the resources left in your CI/CD environment. This doesn’t look like a Cloudflare issue.