IT/Linux

npm run build 시 Process.ChildProcess._handle.onexit Exit status 137에러

bepuri 2021. 2. 15. 17:10
728x90

내 경우는 메모리 문제라고 예상했고 아래 swap space를 추가해주었다.

 

linuxize.com/post/how-to-add-swap-space-on-ubuntu-18-04/

 

How to Add Swap Space on Ubuntu 18.04

Swap is a space on a disk that is used when the amount of physical RAM memory is full. This tutorial covers the steps necessary to add a swap file to Ubuntu 18.04.

linuxize.com

 

swap 파티션은 윈도우 가상메모리랑 같다.

메모리가 부족하면 swap 파티션을 메모리로 사용하는거다.

 

swap 파티션이 없다면 메모리 부족시 메모리 오버플로우로 타이틀처럼 프로세스가 종료되어버릴거다.

 

위를 적용하니 아래와같은 에러가 났다.

 

 

 

⠋  Building for production...Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
⠼  Building for production...
<--- Last few GCs --->

[41661:0x36503f0]   198074 ms: Mark-sweep 251.7 (257.8) -> 251.5 (257.8) MB, 1049.3 / 0.0 ms  (average mu = 0.183, current mu = 0.122) allocation failure GC in old space requested
[41661:0x36503f0]   199123 ms: Mark-sweep 251.5 (257.8) -> 251.5 (257.8) MB, 1048.7 / 0.0 ms  (average mu = 0.097, current mu = 0.000) allocation failure GC in old space requested


<--- JS stacktrace --->

==== JS stack trace =========================================

    0: ExitFrame [pc: 0x13c9819]
    1: StubFrame [pc: 0x1435165]
Security context: 0x29ad093c08d1 <JSObject>
    2: parseIdent [0x25f18596a541] [/home/ubuntu/onepaper/frontend/node_modules/acorn/dist/acorn.js:2760] [bytecode=0x2d6a180ae1f9 offset=0](this=0x14b86cdd6261 <Parser map = 0x356c37bbd609>,0x087fc73c0639 <true>,0x087fc73c04b1 <undefined>)
    3: parseSubscript [0x25f185969f41] [/home/ubuntu/onepaper/frontend/node_modules/acorn/d...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0xa08900 node::Abort() [node]
 2: 0xa08d0c node::OnFatalError(char const*, char const*) [node]
 3: 0xb7ef5e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
 4: 0xb7f2d9 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
 5: 0xd2ba45  [node]
 6: 0xd2c0d6 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node]
 7: 0xd38955 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node]
 8: 0xd39805 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
 9: 0xd3af7c v8::internal::Heap::CollectAllAvailableGarbage(v8::internal::GarbageCollectionReason) [node]
10: 0xd3c316 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
11: 0xd08195 v8::internal::Factory::NewByteArray(int, v8::internal::AllocationType) [node]
12: 0xcaa1da v8::internal::TranslationBuffer::CreateByteArray(v8::internal::Factory*) [node]
13: 0x19f9077 v8::internal::compiler::CodeGenerator::GenerateDeoptimizationData() [node]
14: 0x19f97a5 v8::internal::compiler::CodeGenerator::FinalizeCode() [node]
15: 0x1a7962d v8::internal::compiler::PipelineImpl::FinalizeCode(bool) [node]
16: 0x1a7a7e0 v8::internal::compiler::PipelineCompilationJob::FinalizeJobImpl(v8::internal::Isolate*) [node]
17: 0xc55db0 v8::internal::OptimizedCompilationJob::FinalizeJob(v8::internal::Isolate*) [node]
18: 0xc59803 v8::internal::Compiler::FinalizeOptimizedCompilationJob(v8::internal::OptimizedCompilationJob*, v8::internal::Isolate*) [node]
19: 0xc7ede6 v8::internal::OptimizingCompileDispatcher::InstallOptimizedFunctions() [node]
20: 0xce9c9f v8::internal::StackGuard::HandleInterrupts() [node]
21: 0x10443f6 v8::internal::Runtime_StackGuard(int, unsigned long*, v8::internal::Isolate*) [node]
22: 0x13c9819  [node]
Aborted (core dumped)
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR! frontend@0.1.0 build: `vue-cli-service build`
npm ERR! Exit status 134
npm ERR!
npm ERR! Failed at the frontend@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2021-02-15T06_21_57_365Z-debug.log
ubuntu@ip-172-26-9-154:~/onepaper/frontend$ npx browserslist@latest --update-db

 

나는 말 잘듣는 개발자이기에 하라는대로 아래 커맨드를 입력 했다.

$ npx browserslist@latest --update-db

 

위 명령을 실행해도 위 명령을 입력하라는 에러메시지 외에는 여전히 같은 에러가 났다.

아무리봐도 메모리 문제 같아서 해당 에러로 검색한 뒤 아래 답변을 찾았다. 

링크의 답변 중 Bat-Orshikh Baavgaikhuu 의 답변을 참고하여 다시금 빌드를 해보았다.

stackoverflow.com/questions/38558989/node-js-heap-out-of-memory

 

대댓글에 해결됐다는 글이 많은 걸로 봐서 나도 해결될듯한데, 가장 저렴한 서버는 너무나도 빌드속도가 느려서 아직 확인은 못해봤다.

 

----------------- 빌드 속도가 너무 느려서 중간에 취소했다. -----------

ssl 적용을 위해서 Diffie-Hellman Key가 생성되는데로 다시 시도해보고 여전히 빌드에러가 나면 인스턴스를 한단계 높은 걸로 설정하려고 한다.

728x90