当前位置: 首页 > 知识库问答 >
问题:

错误:致命错误:无效标记-压缩接近堆限制分配失败-JavaScript堆内存不足[重复]

史超英
2023-03-14

错误:致命错误:无效标记-压缩接近堆限制分配失败-JavaScript堆内存不足

ERROR: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
ERROR: 
ERROR: Writing Node.js report to file: report.20200213.184418.100257.0.001.json
ERROR: Node.js report completed
ERROR:  1: 0x95bd00 node::Abort() [node]
ERROR:  2: 0x95cc46 node::OnFatalError(char const*, char const*) [node]
ERROR:  3: 0xb3dbde v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
ERROR:  4: 0xb3de14 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
ERROR:  5: 0xf3ce52  [node]
ERROR:  6: 0xf3cf58 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [node]
ERROR:  7: 0xf49678 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node]
ERROR:  8: 0xf4a18b v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
ERROR:  9: 0xf4cec1 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [node]
ERROR: 10: 0xf170f4 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [node]
ERROR: 11: 0x11cd3fe v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [node]
ERROR: 12: 0x2f557e14fc5d 
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 1:07.514s
INFO: Final Memory: 22M/809M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: Failed to run external process `node --max-old-space-size=2048 /var/lib/jenkins/workspace/IPC-Portal/SONAR/Sonar-analysis(IZO-UI-V7)/.sonar/sonarts-bundle/node_modules/tslint-sonarts/bin/tsrunner`. Run with -X for more information
    at org.sonar.plugin.typescript.ExternalTypescriptSensor.executeExternalRunner(ExternalTypescriptSensor.java:256)
    at org.sonar.plugin.typescript.ExternalTypescriptSensor.analyze(ExternalTypescriptSensor.java:130)
    at org.sonar.plugin.typescript.ExternalTypescriptSensor.execute(ExternalTypescriptSensor.java:111)
    at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
    at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
    at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59)
    at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
    at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59)
    at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
    at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:359)
    at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:354)
    at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:317)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
    at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:128)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
    at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:73)
    at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:99)
    at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:62)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
    at com.sun.proxy.$Proxy0.execute(Unknown Source)
    at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:233)
    at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)
    at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:110)
    at org.sonarsource.scanner.cli.Main.execute(Main.java:74)
    at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 2 column 1 path $
    at com.google.gson.Gson.fromJson(Gson.java:891)
    at com.google.gson.Gson.fromJson(Gson.java:817)
    at org.sonar.plugin.typescript.ExternalTypescriptSensor.executeExternalRunner(ExternalTypescriptSensor.java:247)
    ... 32 more
Caused by: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 2 column 1 path $
    at com.google.gson.stream.JsonReader.beginArray(JsonReader.java:351)
    at com.google.gson.internal.bind.ArrayTypeAdapter.read(ArrayTypeAdapter.java:70)
    at com.google.gson.Gson.fromJson(Gson.java:879)
    ... 34 more
ERROR: 
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succeeded?
ERROR: SonarQube scanner exited with non-zero code: 1
Previous steps failed the build.
Result is: FAILURE
Build step 'Quality Gates Sonarqube Plugin' marked build as failure
Finished: FAILURE

我们无法解决此错误。帮助我们解决如何增加javascript堆内存的问题

共有1个答案

司徒高丽
2023-03-14

转到package.json添加

  • 节点--max_old_space_size=8192./node_modules/@angull/cli/bin/ng--build--prod

**

 "ng-high-memory": "node --max_old_space_size=8192./node_modules/@angular/cli/bin/ng",
"build:ssr:high-mem": "npm run ng-high-memory -- build --prod && npm run ng-high-memory -- run app:server:production && npm run compile:server --bundleDependencies all"
 类似资料: