I encountered this error while trying to build a Next.js app in production using 'yarn build'.
I am completely lost and unable to find any helpful resources to resolve this.
Please, I need assistance urgently!!!
TypeError: Converting circular structure to JSON
--> starting at object with constructor 'ClientRequest'
| property 'socket' -> object with constructor 'TLSSocket'
--- property '_httpMessage' closes the circle
at stringify (<anonymous>)
at writeChannelMessage (node:internal/child_process/serialization:127:20)
at process.target._send (node:internal/child_process:839:17)
at process.target.send (node:internal/child_process:739:19)
at reportError (/home/rashid/code/projects/blog-web-next/node_modules/next/dist/compiled/jest-worker/processChild.js:1:1993)
at reportClientError (/home/rashid/code/projects/blog-web-next/node_modules/next/dist/compiled/jest-worker/processChild.js:1:1669)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
> Build error occurred
Error: Call retries were exceeded
at ChildProcessWorker.initialize (/home/rashid/code/projects/blog-web-next/node_modules/next/dist/compiled/jest-worker/index.js:1:12037)
at ChildProcessWorker._onExit (/home/rashid/code/projects/blog-web-next/node_modules/next/dist/compiled/jest-worker/index.js:1:12975)
at ChildProcess.emit (node:events:527:28)
at ChildProcess.emit (node:domain:475:12)
at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12) {
type: 'WorkerError'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
It fails at this particular step
info - Collecting page data ...node:internal/child_process/serialization:127
const string = JSONStringify(message) + '\n';