I'm copy to cloud server fresh next app created by npx create-next-app. When i try run build script the server throws an error 'pthread-create: Resource temporarilt unavalible'.
{
"name": "next",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"next": "12.1.0",
"react": "17.0.2",
"react-dom": "17.0.2"
},
"devDependencies": {
"eslint": "8.11.0",
"eslint-config-next": "12.1.0"
}
}
next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
}
module.exports = nextConfig
I wrote ticket to server administration and they answered me that server has 32 process limit but next app ned 64 process.
Is there any way to limit nuber of processes on build script?
I found this article: https://docs.uniform.dev/sitecore/deploy/how-tos/how-to-control-nextjs-threads/
Which had a next config:
experimental: {
// This is experimental but can
// be enabled to allow parallel threads
// with nextjs automatic static generation
workerThreads: false,
cpus: 1
},
This will slow down the build a lot, but will also reduce the number of pages it tries to build simultaneously, which can help if your backend is buckling under the number of requests.