Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker build failed ,report :Reached heap limit Allocation failed - JavaScript heap out of memory #1008

Closed
ZhaoGuangYue1986 opened this issue Apr 27, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@ZhaoGuangYue1986
Copy link

ZhaoGuangYue1986 commented Apr 27, 2024

Docker build failed ,report :Reached heap limit Allocation failed - JavaScript heap out of memory
ps: i have add " && node --max_old_space_size=8000" in package.json, but it still report error

error log like below:

ERROR [build-stage 6/6] RUN pnpm build 199.9s

[build-stage 6/6] RUN pnpm build:
1.401
1.401 [email protected] build /app
1.401 vue-tsc --noEmit && vite build && node --max_old_space_size=8000
1.401
20.12 vite v4.5.1 building for production...
20.28 transforming...
73.55 [plugin:vite:resolve] Module "crypto" has been externalized for browser compatibility, imported by "/app/node_modules/.pnpm/[email protected]/node_modules/bcryptjs/dist/bcrypt.js". See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
74.40 [plugin:vite:resolve] Module "path" has been externalized for browser compatibility, imported by "/app/node_modules/.pnpm/[email protected]/node_modules/mime-types/index.js". See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
88.46 [plugin:vite:resolve] Module "tls" has been externalized for browser compatibility, imported by "/app/node_modules/.pnpm/[email protected]/node_modules/pdf-signature-reader/helpers/verification.js". See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
114.8 node_modules/.pnpm/[email protected]/node_modules/iarna-toml-esm/lib/toml-parser.js (183:22) Use of eval in "node_modules/.pnpm/[email protected]/node_modules/iarna-toml-esm/lib/toml-parser.js" is strongly discouraged as it poses security risks and may cause issues with minification.
115.0 node_modules/.pnpm/[email protected]/node_modules/js-sha256/src/sha256.js (83:17) Use of eval in "node_modules/.pnpm/[email protected]/node_modules/js-sha256/src/sha256.js" is strongly discouraged as it poses security risks and may cause issues with minification.
115.0 node_modules/.pnpm/[email protected]/node_modules/js-sha256/src/sha256.js (84:17) Use of eval in "node_modules/.pnpm/[email protected]/node_modules/js-sha256/src/sha256.js" is strongly discouraged as it poses security risks and may cause issues with minification.
158.4 ✓ 18272 modules transformed.
185.1
185.1 --- Last few GCs ---
185.1
185.1 [30:0x7efda036a6c0] 164943 ms: Mark-Compact (reduce) 2015.8 (2083.9) -> 2014.8 (2083.9) MB, 2391.65 / 0.00 ms (average mu = 0.065, current mu = 0.009) allocation failure; scavenge might not succeed
185.1 [30:0x7efda036a6c0] 167547 ms: Mark-Compact (reduce) 2016.0 (2083.9) -> 2015.0 (2084.2) MB, 2599.64 / 0.00 ms (average mu = 0.034, current mu = 0.001) allocation failure; scavenge might not succeed
185.1
185.1
185.1 --- JS stacktrace ---
185.1
185.1 FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
185.1 ----- Native stack trace -----
185.1
198.4 Aborted (core dumped)
199.0  ELIFECYCLE  Command failed with exit code 134.

Dockerfile:10

8 | RUN npm install -g pnpm && pnpm i --frozen-lockfile
9 | COPY . .
10 | RUN pnpm build
11 |
12 | # production stage

ERROR: failed to solve: process "/bin/sh -c pnpm build" did not complete successfully: exit code: 134

@ZhaoGuangYue1986 ZhaoGuangYue1986 added the bug Something isn't working label Apr 27, 2024
@ZhaoGuangYue1986
Copy link
Author

ZhaoGuangYue1986 commented May 9, 2024

ENV NODE_OPTIONS="--max-old-space-size=4096"

add above option in dockfile can deal this problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants