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

Rasperry Pi上的Build Angular应用程序导致无效的标记-堆限制分配失败附近的压缩-JavaScript堆内存不足

穆博简
2023-03-14

我写了一个棱角分明的应用程序,供自己使用。我想在我的Rasperry PI3+上运行它。该应用程序运行在我的Linux Mint19.3环境中,不存在任何问题。但在Rasppery上我确实会出错。当我运行代码时,以下内容适用:

10%构建3/3模块0活动ℹ的equwds.:Project正在运行于http://localhost:4200/webpack-dev-server/ℹ的equwds@:webpack输出由/ℹ的equwds@:404S将回退到//index.html 93%...k资产优化SourceMapDevToolPlugin vendor.js生成SourceMap<---最后几个GC---->

[5260:0x340DB28]104721 ms:Mark-sweep 225.2(231.7)->224.8(231.7)MB,1080.3/0.2 ms(平均mu=0.081,当前mu=0.028)分配失败清除可能不会成功[5260:0x340DB28]
106073 ms:Mark-sweep 225.2(231.7)->224.9(231.7)MB,1335.5/0.2 ms(平均mu=0.045,当前mu=0.012)分配失败清除可能不会成功

<----JS StackTrace---->

=====JS栈迹==========================================================================

0: ExitFrame [pc: 0xe52060] Security context: 0x2b20e225 <JSObject>
1: /* anonymous */ [0x57fd43c5] [/home/pi/has/node_modules/webpack-sources/node_modules/source-map/lib/source-node.js:~342]

[PC=0x41AF13E0](this=0x3E542281,0x6E193FCD,0x6E3D45F9)2:SourceNode_walk[0x3D55EA81][/home/pi/has/node_modules/webpack-...

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

将node.js报告写入文件:report.20200102.193729.5260.0.001.json node.js报告已完成

角型

Angular CLI: 8.3.21
Node: 12.14.0
OS: linux arm
Angular: 8.2.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.21
@angular-devkit/build-angular     0.803.21
@angular-devkit/build-optimizer   0.803.21
@angular-devkit/build-webpack     0.803.21
@angular-devkit/core              8.3.21
@angular-devkit/schematics        8.3.21
@angular/cdk                      8.2.3
@angular/cli                      8.3.21
@angular/material                 8.2.3
@ngtools/webpack                  8.3.21
@schematics/angular               8.3.21
@schematics/update                0.803.21
rxjs                              6.4.0
typescript                        3.5.3
webpack                           4.39.2

我尝试了node-max_old_space_size=8192 node_modules/@angular/cli/bin/ng build,但这带来了相同的问题,但错误消息FATAL error:CALL_AND_RETRY_LAST Allocation failed-JavaScript堆out of memory。

错误日志的完整输出:

null

{
  "header": {
    "reportVersion": 1,
    "event": "Allocation failed - JavaScript heap out of memory",
    "trigger": "FatalError",
    "filename": "report.20200102.193729.5260.0.001.json",
    "dumpEventTime": "2020-01-02T19:37:29Z",
    "dumpEventTimeStamp": "1577990249360",
    "processId": 5260,
    "cwd": "/home/pi/has",
    "commandLine": [
      "node",
      "/usr/local/bin/ng",
      "serve"
    ],
    "nodejsVersion": "v12.14.0",
    "glibcVersionRuntime": "2.24",
    "glibcVersionCompiler": "2.24",
    "wordSize": 32,
    "arch": "arm",
    "platform": "linux",
    "componentVersions": {
      "node": "12.14.0",
      "v8": "7.7.299.13-node.16",
      "uv": "1.33.1",
      "zlib": "1.2.11",
      "brotli": "1.0.7",
      "ares": "1.15.0",
      "modules": "72",
      "nghttp2": "1.39.2",
      "napi": "5",
      "llhttp": "1.1.4",
      "http_parser": "2.8.0",
      "openssl": "1.1.1d",
      "cldr": "35.1",
      "icu": "64.2",
      "tz": "2019c",
      "unicode": "12.1"
    },
    "release": {
      "name": "node",
      "lts": "Erbium",
      "headersUrl": "https://nodejs.org/download/release/v12.14.0/node-v12.14.0-headers.tar.gz",
      "sourceUrl": "https://nodejs.org/download/release/v12.14.0/node-v12.14.0.tar.gz"
    },
    "osName": "Linux",
    "osRelease": "4.19.66-v7+",
    "osVersion": "#1253 SMP Thu Aug 15 11:49:46 BST 2019",
    "osMachine": "armv7l",
    "cpus": [
      {
        "model": "ARMv7 Processor rev 4 (v7l)",
        "speed": 1200,
        "user": 3946500,
        "nice": 0,
        "sys": 523700,
        "idle": 286109100,
        "irq": 0
      },
      {
        "model": "ARMv7 Processor rev 4 (v7l)",
        "speed": 1200,
        "user": 4518000,
        "nice": 0,
        "sys": 503400,
        "idle": 295956800,
        "irq": 0
      },
      {
        "model": "ARMv7 Processor rev 4 (v7l)",
        "speed": 1200,
        "user": 5118000,
        "nice": 0,
        "sys": 337100,
        "idle": 300228000,
        "irq": 0
      },
      {
        "model": "ARMv7 Processor rev 4 (v7l)",
        "speed": 1200,
        "user": 4341100,
        "nice": 0,
        "sys": 402500,
        "idle": 298362700,
        "irq": 0
      }
    ],
    "networkInterfaces": [
      {
        "name": "lo",
        "internal": true,
        "mac": "00:00:00:00:00:00",
        "address": "127.0.0.1",
        "netmask": "255.0.0.0",
        "family": "IPv4"
      },
      {
        "name": "wlan0",
        "internal": false,
        "mac": "b8:27:eb:4c:2c:35",
        "address": "192.168.0.102",
        "netmask": "255.255.255.0",
        "family": "IPv4"
      },
      {
        "name": "lo",
        "internal": true,
        "mac": "00:00:00:00:00:00",
        "address": "::1",
        "netmask": "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
        "family": "IPv6",
        "scopeid": 0
      },
      {
        "name": "wlan0",
        "internal": false,
        "mac": "b8:27:eb:4c:2c:35",
        "address": "fe80::6d47:a3cb:9456:52b8",
        "netmask": "ffff:ffff:ffff:ffff::",
        "family": "IPv6",
        "scopeid": 3
      }
    ],
    "host": "raspberrypi"
  },
  "javascriptStack": {
    "message": "No stack.",
    "stack": [
      "Unavailable."
    ]
  },
  "nativeStack": [
  ],
  "javascriptHeap": {
    "totalMemory": 244576256,
    "totalCommittedMemory": 242602288,
    "usedMemory": 235924732,
    "availableMemory": 6366124,
    "memoryLimit": 248512512,
    "heapSpaces": {
      "read_only_space": {
        "memorySize": 262144,
        "committedMemory": 22240,
        "capacity": 262008,
        "used": 22104,
        "available": 239904
      },
      "new_space": {
        "memorySize": 2097152,
        "committedMemory": 608500,
        "capacity": 1048032,
        "used": 83428,
        "available": 964604
      },
      "old_space": {
        "memorySize": 192204800,
        "committedMemory": 192198140,
        "capacity": 189165284,
        "used": 188987956,
        "available": 177328
      },
      "code_space": {
        "memorySize": 2523136,
        "committedMemory": 2284512,
        "capacity": 2067776,
        "used": 2067776,
        "available": 0
      },
      "map_space": {
        "memorySize": 4198400,
        "committedMemory": 4198272,
        "capacity": 1685120,
        "used": 1685120,
        "available": 0
      },
      "large_object_space": {
        "memorySize": 42668032,
        "committedMemory": 42668032,
        "capacity": 42532684,
        "used": 42532684,
        "available": 0
      },
      "code_large_object_space": {
        "memorySize": 622592,
        "committedMemory": 622592,
        "capacity": 545664,
        "used": 545664,
        "available": 0
      },
      "new_large_object_space": {
        "memorySize": 0,
        "committedMemory": 0,
        "capacity": 1048032,
        "used": 0,
        "available": 1048032
      }
    }
  },
  "resourceUsage": {
    "userCpuSeconds": 196.452,
    "kernelCpuSeconds": 2.65665,
    "cpuConsumptionPercent": 186.083,
    "maxRss": 301801472,
    "pageFaults": {
      "IORequired": 0,
      "IONotRequired": 150376
    },
    "fsActivity": {
      "reads": 2880,
      "writes": 0
    }
  },
  "uvthreadResourceUsage": {
    "userCpuSeconds": 99.4757,
    "kernelCpuSeconds": 1.90042,
    "cpuConsumptionPercent": 94.7441,
    "fsActivity": {
      "reads": 2880,
      "writes": 0
    }
  },
  "libuv": [
  ],
  "environmentVariables": {
    "LS_COLORS": "rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:",
    "LANG": "de_AT.UTF-8",
    "NO_AT_BRIDGE": "1",
    "TERM": "xterm-256color",
    "PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
    "MAIL": "/var/mail/root",
    "LOGNAME": "root",
    "USER": "root",
    "USERNAME": "root",
    "HOME": "/root",
    "SHELL": "/bin/bash",
    "SUDO_COMMAND": "/usr/local/bin/ng serve",
    "SUDO_USER": "pi",
    "SUDO_UID": "1000",
    "SUDO_GID": "1000",
    "WEBPACK_DEV_SERVER": "true"
  },
  "userLimits": {
    "core_file_size_blocks": {
      "soft": 0,
      "hard": "unlimited"
    },
    "data_seg_size_kbytes": {
      "soft": "unlimited",
      "hard": "unlimited"
    },
    "file_size_blocks": {
      "soft": "unlimited",
      "hard": "unlimited"
    },
    "max_locked_memory_bytes": {
      "soft": "unlimited",
      "hard": "unlimited"
    },
    "max_memory_size_kbytes": {
      "soft": "unlimited",
      "hard": "unlimited"
    },
    "open_files": {
      "soft": 1048576,
      "hard": 1048576
    },
    "stack_size_bytes": {
      "soft": 8388608,
      "hard": "unlimited"
    },
    "cpu_time_seconds": {
      "soft": "unlimited",
      "hard": "unlimited"
    },
    "max_user_processes": {
      "soft": 7336,
      "hard": 7336
    },
    "virtual_memory_kbytes": {
      "soft": "unlimited",
      "hard": "unlimited"
    }
  },
  "sharedObjects": [
    "linux-vdso.so.1",
    "/usr/lib/arm-linux-gnueabihf/libarmmem.so",
    "/lib/arm-linux-gnueabihf/libdl.so.2",
    "/usr/lib/arm-linux-gnueabihf/libstdc++.so.6",
    "/lib/arm-linux-gnueabihf/libm.so.6",
    "/lib/arm-linux-gnueabihf/libgcc_s.so.1",
    "/lib/arm-linux-gnueabihf/libpthread.so.0",
    "/lib/arm-linux-gnueabihf/libc.so.6",
    "/lib/ld-linux-armhf.so.3",
    "/lib/arm-linux-gnueabihf/libnss_files.so.2",
    "/lib/arm-linux-gnueabihf/libnss_mdns4_minimal.so.2",
    "/lib/arm-linux-gnueabihf/libnss_dns.so.2",
    "/lib/arm-linux-gnueabihf/libresolv.so.2"
  ]
}

null

知道我需要在Rasperry上配置什么来使应用程序运行吗?

共有1个答案

涂羽
2023-03-14
ng serve --sourceMap=false

解决了这个问题,因为没有使用源映射。

 类似资料: