When running npm run build, I get the following error: “EMFILE: too many open files”
> project@0.1.0 build
> next build
▲ Next.js 14.2.35
- Environments: .env.local
Skipping linting
✓ Checking validity of types
Creating an optimized production build ...
✓ Compiled successfully
✓ Collecting page data
✓ Generating static pages (9/9)
Error: EMFILE: too many open files, open 'C:\Code\project-node\project_next\node_modules\intl-messageformat\src\error.js'
at async open (node:internal/fs/promises:641:25)
at async Object.readFile (node:internal/fs/promises:1245:14)
at async Job.readFile (C:\Code\project-node\project_next\node_modules\next\dist\build\collect-build-traces.js:331:32)
at async Job.emitDependency (C:\Code\project-node\project_next\node_modules\next\dist\compiled\@vercel\nft\index.js:1:40028)
at async Job.maybeEmitDep (C:\Code\project-node\project_next\node_modules\next\dist\compiled\@vercel\nft\index.js:1:37013)
at async Promise.all (index 2)
at async Job.emitDependency (C:\Code\project-node\project_next\node_modules\next\dist\compiled\@vercel\nft\index.js:1:40278)
at async Job.maybeEmitDep (C:\Code\project-node\project_next\node_modules\next\dist\compiled\@vercel\nft\index.js:1:37013)
at async Promise.all (index 0)
at async Job.emitDependency (C:\Code\project-node\project_next\node_modules\next\dist\compiled\@vercel\nft\index.js:1:40278) {
errno: -4066,
code: 'EMFILE',
syscall: 'open',
path: 'C:\\Code\\project-node\\project_next\\node_modules\\intl-messageformat\\src\\error.js'
}
I’m running Node 22.21.1 on Windows 11, and Plasmic installs Next.JS 14.2.35 on project create. I’m a bit hesitant to run using WSL, since the final product runs on Windows. I can’t disable file output tracing if I want to use the output: ‘standlone’ option.
This is a known issue with NextJS:
- Error: EMFILE: too many open files · Issue #52646 · vercel/next.js
- Next.Js 14.1.0 Facing Build Error With Too Many Open Files · Issue #64093 · vercel/next.js
- Next.js v15.3.3 Node.js v18.18.0 On Windows, and you’re facing EMFILE / EPERM errors during build. this while creating build of next js project · vercel/next.js · Discussion #80649
- Error: EMFILE: too many open files · Issue #52646 · vercel/next.js
Here are the things I have tried to no avail:
- Experimental: Turbotrace
- Experimental: Excluded certain files.
- Ran
setx NODE_OPTIONS "--max-old-space-size=4096"in Powershell before the build. - Ignore lint during builds.
Here is the current next.config.mjs file:
/** @type {import('next').NextConfig} */
const nextConfig = {
eslint: { ignoreDuringBuilds: true },
trailingSlash: true,
reactStrictMode: false,
staticPageGenerationTimeout: 600,
output: 'standalone',
};
export default nextConfig;
The ultimate goal is to have a small, portable build to install client side. I know most Plasmic apps are server-side, but due to our IT infrastructure, I have to run the app locally.
How can I do this?