NEXTJS - 生产构建错误 - 在"全局线程池尚未初始化"时惊慌失措



我使用Heroku来托管我的应用程序,当我运行git push heroku main时,它给了我以下错误:panicked at 'the global thread pool has not been initialized.: threadpool builderror { kind: ioerror(error { kind: unsupported, message: "operation not supported on this platform" }) }'

我该如何解决这个问题?语言= NextJShost = Heroku

这是我的包裹。Json,完整的错误日志&next.config.js

<标题>package.json h1> 整错误日志
remote:        info  - Creating an optimized production build...
remote: warn  - Found lockfile missing swc dependencies, run next locally to automatically patch
remote:        info  - Downloading WASM swc package...
remote:        info  - Using experimental wasm build of next-swc
remote: warn  - Attempted to load @next/swc-linux-x64-gnu, but it was not installed
remote: warn  - Attempted to load @next/swc-linux-x64-gnux32, but it was not installed
remote: warn  - Attempted to load @next/swc-linux-x64-musl, but it was not installed
remote: panicked at 'The global thread pool has not been initialized.: ThreadPoolBuildError { kind: IOError(Error { kind: Unsupported, message: "operation not supported on this platform" }) }', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.9.1/src/registry.rs:170:10
remote:
remote: Stack:
remote:
remote: Error
remote:     at module.exports.__wbg_new_693216e109162396 (/tmp/build_4bef0c6e/node_modules/next/wasm/@next/swc-wasm-nodejs/wasm.js:202:17)  
remote:     at wasm://wasm/059aa236:wasm-function[5445]:0xf90917
remote:     at wasm://wasm/059aa236:wasm-function[13700]:0x11eca7b
remote:     at wasm://wasm/059aa236:wasm-function[9995]:0x1186adc
remote:     at wasm://wasm/059aa236:wasm-function[11009]:0x11b6862
remote:     at wasm://wasm/059aa236:wasm-function[12785]:0x11e5cdd
remote:     at wasm://wasm/059aa236:wasm-function[11383]:0x11c358f
remote:     at wasm://wasm/059aa236:wasm-function[10017]:0x1187e72
remote:     at wasm://wasm/059aa236:wasm-function[1151]:0x98decd
remote:     at wasm://wasm/059aa236:wasm-function[654]:0x75f3f2
remote:
remote:
remote: panicked at 'The global thread pool has not been initialized.: ThreadPoolBuildError { kind: GlobalPoolAlreadyInitialized }', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.9.1/src/registry.rs:170:10
remote:
remote: Stack:
remote:
remote: Error
remote:     at module.exports.__wbg_new_693216e109162396 (/tmp/build_4bef0c6e/node_modules/next/wasm/@next/swc-wasm-nodejs/wasm.js:202:17)  
remote:     at wasm://wasm/059aa236:wasm-function[5445]:0xf90917
remote:     at wasm://wasm/059aa236:wasm-function[13700]:0x11eca7b
remote:     at wasm://wasm/059aa236:wasm-function[9995]:0x1186adc
remote:     at wasm://wasm/059aa236:wasm-function[11009]:0x11b6862
remote:     at wasm://wasm/059aa236:wasm-function[12785]:0x11e5cdd
remote:     at wasm://wasm/059aa236:wasm-function[11383]:0x11c358f
remote:     at wasm://wasm/059aa236:wasm-function[10017]:0x1187e72
remote:     at wasm://wasm/059aa236:wasm-function[1151]:0x98decd
remote:     at wasm://wasm/059aa236:wasm-function[654]:0x75f3f2
remote:
remote:
remote: Failed to compile.
remote:
remote: static/chunks/framework-e5dffe227a349f5b.js from Terser
remote: unreachable
remote: RuntimeError: unreachable
remote:     at wasm://wasm/059aa236:wasm-function[9995]:0x1186aff
remote:     at wasm://wasm/059aa236:wasm-function[11009]:0x11b6862
remote:     at wasm://wasm/059aa236:wasm-function[12785]:0x11e5cdd
remote:     at wasm://wasm/059aa236:wasm-function[11383]:0x11c358f
remote:     at wasm://wasm/059aa236:wasm-function[10017]:0x1187e72
remote:     at wasm://wasm/059aa236:wasm-function[1151]:0x98decd
remote:     at wasm://wasm/059aa236:wasm-function[654]:0x75f3f2
remote:     at wasm://wasm/059aa236:wasm-function[654]:0x760098
remote:     at wasm://wasm/059aa236:wasm-function[3154]:0xd6fe73
remote:     at wasm://wasm/059aa236:wasm-function[654]:0x75f24f
remote:
remote: static/chunks/80-ae3f54929433d50c.js from Terser
remote: unreachable
remote: RuntimeError: unreachable
remote:     at wasm://wasm/059aa236:wasm-function[9995]:0x1186afd
remote:     at wasm://wasm/059aa236:wasm-function[11009]:0x11b6862
remote:     at wasm://wasm/059aa236:wasm-function[12785]:0x11e5cdd
remote:     at wasm://wasm/059aa236:wasm-function[11383]:0x11c358f
remote:     at wasm://wasm/059aa236:wasm-function[10017]:0x1187e72
remote:     at wasm://wasm/059aa236:wasm-function[1151]:0x98decd
remote:     at wasm://wasm/059aa236:wasm-function[654]:0x75f3f2
remote:     at wasm://wasm/059aa236:wasm-function[654]:0x760098
remote:     at wasm://wasm/059aa236:wasm-function[3154]:0xd6fe73
remote:     at wasm://wasm/059aa236:wasm-function[654]:0x75f24f
remote:
remote: static/chunks/920-43714e5c99ca734b.js from Terser
remote: unreachable
remote: RuntimeError: unreachable
remote:     at wasm://wasm/059aa236:wasm-function[9995]:0x1186afd
remote:     at wasm://wasm/059aa236:wasm-function[11009]:0x11b6862
remote:     at wasm://wasm/059aa236:wasm-function[12785]:0x11e5cdd
remote:     at wasm://wasm/059aa236:wasm-function[11383]:0x11c358f
remote:     at wasm://wasm/059aa236:wasm-function[10017]:0x1187e72
remote:     at wasm://wasm/059aa236:wasm-function[1151]:0x98decd
remote:     at wasm://wasm/059aa236:wasm-function[654]:0x75f3f2
remote:     at wasm://wasm/059aa236:wasm-function[654]:0x760098
remote:     at wasm://wasm/059aa236:wasm-function[3154]:0xd6fe73
remote:     at wasm://wasm/059aa236:wasm-function[654]:0x75f24f
remote:
remote: static/chunks/153-7f28d108df7ea80a.js from Terser
remote: unreachable
remote: RuntimeError: unreachable
remote:     at wasm://wasm/059aa236:wasm-function[9995]:0x1186afd
remote:     at wasm://wasm/059aa236:wasm-function[11009]:0x11b6862
remote:     at wasm://wasm/059aa236:wasm-function[12785]:0x11e5cdd
remote:     at wasm://wasm/059aa236:wasm-function[11383]:0x11c358f
remote:     at wasm://wasm/059aa236:wasm-function[10017]:0x1187e72
remote:     at wasm://wasm/059aa236:wasm-function[1151]:0x98decd
remote:     at wasm://wasm/059aa236:wasm-function[654]:0x75f3f2
remote:
remote:  !     Push rejected, failed to compile Node.js app.
remote:
remote:  !     Push failed
<标题>next.config.js h1> 尝试使用最新的node版本和旧的node@16版本,但它们都不起作用。

这似乎是一个问题与swcMinify选项在nextConfig,尝试将其设置为false。

const nextConfig = {
reactStrictMode: true,
swcMinify: false,
};

最新更新