简体   繁体   中英

NEXTJS - Production Build Error - panicked at 'the global thread pool has not been initialized

I am using Heroku to host my app and when I run git push heroku main it gives me the following error: panicked at 'the global thread pool has not been initialized.: threadpool builderror { kind: ioerror(error { kind: unsupported, message: "operation not supported on this platform" }) }'

How should I solv this issue? Language = NextJS hosting = Heroku

And here is my package.json, full error log & next.config.js

package.json

{
  "name": "invoice-website",
  "version": "0.1.0",
  "private": true,
  "engines": {
    "node": "16.x",
    "npm": "8.x"
  },
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@emotion/cache": "^11.10.5",
    "@emotion/react": "^11.10.5",
    "@emotion/server": "^11.10.0",
    "@emotion/styled": "^11.10.5",
    "@mui/lab": "^5.0.0-alpha.105",
    "@mui/material": "^5.10.11",
    "axios": "^1.1.3",
    "bcryptjs": "^2.4.3",
    "cookie": "^0.5.0",
    "feather-icons-react": "^0.5.0",
    "jsonwebtoken": "^8.5.1",
    "mongoose": "^6.7.0",
    "next": "^12.2.0",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-infinite-scroll-component": "^6.1.0",
    "react-redux": "^8.0.4",
    "redux": "^4.2.0",
    "redux-thunk": "^2.4.1"
  },
  "devDependencies": {
    "autoprefixer": "^10.4.13",
    "eslint": "8.26.0",
    "eslint-config-next": "13.0.0",
    "postcss": "^8.4.18",
    "tailwindcss": "^3.2.1"
  }
}

Full ERROR Log

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

/** @type {import('next').NextConfig} */
const nextConfig = {
  reactStrictMode: true,
  swcMinify: true,
};

module.exports = nextConfig;

I tried using latest node version and old node@16 version but none of them worked.

It seems like an issue with the swcMinify option in the nextConfig, try setting it to false.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM