将 Next js 部署到云端的问题

Problems with deploying Next js to the cloud

我正在使用 A2Hosting 供应商将我的 Next js 应用部署为服务器。我已经编写了所有脚本并在我的本地机器上进行了测试,但是当我将它部署到网络服务器并且 运行 npm 运行 build 这是发生了什么:

throw errnoException(err, 'spawn'); ^
Error: spawn ENOMEM
at ChildProcess.spawn (internal/child_process.js:394:11)
at spawn (child_process.js:540:9)
at Object.fork (child_process.js:108:10)
at ChildProcessWorker.initialize (/home/briddgyc/nodevenv/Br-Front/12/lib/node_modules/jest-worker/build/workers/ChildProcessWorker.js:137:44)
at new ChildProcessWorker (/home/briddgyc/nodevenv/Br-Front/12/lib/node_modules/jest-worker/build/workers/ChildProcessWorker.js:127:10)
at WorkerPool.createWorker (/home/briddgyc/nodevenv/Br-Front/12/lib/node_modules/jest-worker/build/WorkerPool.js:44:12)
at new BaseWorkerPool (/home/briddgyc/nodevenv/Br-Front/12/lib/node_modules/jest-worker/build/base/BaseWorkerPool.js:82:27)
at new WorkerPool (/home/briddgyc/nodevenv/Br-Front/12/lib/node_modules/jest-worker/build/WorkerPool.js:30:1)
at new JestWorker (/home/briddgyc/nodevenv/Br-Front/12/lib/node_modules/jest-worker/build/index.js:131:26)
at TaskRunner.run (/home/briddgyc/nodevenv/Br-Front/12/lib/node_modules/next/dist/build/webpack/plugins/terser-webpack-plugin/src/TaskRunner.js:3:202)       {
errno: 'ENOMEM',
code: 'ENOMEM',
syscall: 'spawn'
}

我已经检查过这是某种内存问题,但是 2 天了仍然无法弄清楚任何问题。 我的机器上还有 40 个进程和 700mb 内存,我想应该足够了。 有什么建议吗?

我收到支持的回复,说只能在本地编译。

该进程占用了 CPU 的 110% 以上,达到了最大进程数的 50/50,而我的项目仍在进行到一半。添加更多命令,甚至可能需要更多资源进行稍后编译,我宁愿保持安全并在本地编译。