NextJS upgrade causes too many open files error in gradle build
Unanswered
fewd_123 posted this in #help-forum
fewd_123OP
I tried upgrading from NextJS 13 to 14 and everything is fine in local but when I try gradle build in server, it causes too many open files error.
Error: EMFILE: too many open files, open '/work/.next/server/pages/api/create-account/tests/index.test.js'] {
errno: -24,
code: 'EMFILE',
Error: EMFILE: too many open files, open '/work/.next/server/pages/api/create-account/tests/index.test.js'] {
errno: -24,
code: 'EMFILE',
19 Replies
@fewd_123 I tried upgrading from NextJS 13 to 14 and everything is fine in local but when I try gradle build in server, it causes too many open files error.
Error: EMFILE: too many open files, open '/work/.next/server/pages/api/create-account/__tests__/index.test.js'] {
errno: -24,
code: 'EMFILE',
could you try this in
next.config.jsexperimental: {
workerThreads: false,
cpus: 1
},fewd_123OP
Trying now. BUt meanwhile, what does this do
@fewd_123 Trying now. BUt meanwhile, what does this do
because next will spin up as many thread as it can when building
and may cause
too many open filesif it works, you could adjust the cpus value. I think with cpus 1 the build will become a little bit slow?
fewd_123OP
I am trying now. Will keep you posted
fewd_123OP
That did not help. Still broke gradle build with the same error - too many open files
@fewd_123 I tried upgrading from NextJS 13 to 14 and everything is fine in local but when I try gradle build in server, it causes too many open files error.
Error: EMFILE: too many open files, open '/work/.next/server/pages/api/create-account/__tests__/index.test.js'] {
errno: -24,
code: 'EMFILE',
you have a file in
/pages/api/create-account/test/index.test.js?fewd_123OP
I do and I deleted the one in the error last time and a new one came up. It just brings up random files for each build
@fewd_123 I do and I deleted the one in the error last time and a new one came up. It just brings up random files for each build
have you tried to
npm run build on locally?fewd_123OP
it passed
@fewd_123 it passed
you hosting in a vps?
fewd_123OP
yes
@fewd_123 yes
linux?
fewd_123OP
yes
@fewd_123 yes
ok I think there is two way to fix it
1. increase the file limit
2. build a standalone output and upload the folder to server
1. increase the file limit
2. build a standalone output and upload the folder to server
fewd_123OP
BUt why did this error come up only with NextJS upgrade? it does not happen when I downgrade NextJS to 13
@fewd_123 BUt why did this error come up only with NextJS upgrade? it does not happen when I downgrade NextJS to 13
well I'm not sure what they added in next 14 and causing this issue