zoukankan      html  css  js  c++  java
  • angular4+ionic3 运行报错 Ineffective mark-compacts near heap limit Allocation failed

    项目框架:angular4 + ionic3

    执行 npm run ionic:serve 运行时报错 Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

    报错代码如下:

    <--- JS stacktrace --->
    
    ==== JS stack trace =========================================
    
        0: ExitFrame [pc: 0000008892B5C5C1]
    Security context: 0x038b15f9e6e9 <JSObject>
        1: nextToken [00000020268433D9] [D:knxvxMobile
    ode_modulespostcsslib	okenize.js:~66] [pc=000000889419ECB9](this=0x002026843419 <Object map = 0000027F88BCF729>)
        2: parse [0000015C88944011] [D:knxvxMobile
    ode_modulespostcsslibparser.js:~52] [pc=0000008894190AAC](this=0x002026843449 <Parser map = 0000027F88BCF781>)
        3: parse(aka parse) ...
    
    FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
     1: 00007FF7FDB3F04A v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+5114
     2: 00007FF7FDB1A0C6 node::MakeCallback+4518
     3: 00007FF7FDB1AA30 node_module_register+2032
     4: 00007FF7FDDA20EE v8::internal::FatalProcessOutOfMemory+846
     5: 00007FF7FDDA201F v8::internal::FatalProcessOutOfMemory+639
     6: 00007FF7FE2C2BC4 v8::internal::Heap::MaxHeapGrowingFactor+9556
     7: 00007FF7FE2B9C46 v8::internal::ScavengeJob::operator=+24310
     8: 00007FF7FE2B829C v8::internal::ScavengeJob::operator=+17740
     9: 00007FF7FE2C0F87 v8::internal::Heap::MaxHeapGrowingFactor+2327
    10: 00007FF7FE2C1006 v8::internal::Heap::MaxHeapGrowingFactor+2454
    11: 00007FF7FDE7CDB7 v8::internal::Factory::NewFillerObject+55
    12: 00007FF7FDF12CC6 v8::internal::WasmJs::Install+29414
    13: 0000008892B5C5C1
    npm ERR! code ELIFECYCLE
    npm ERR! errno 134
    npm ERR! Vxmobile-ionic@ ionic:serve: `node copy-env-config.js --env dev | ionic-app-scripts serve --max_old_space_size=4096`
    npm ERR! Exit status 134
    npm ERR!
    npm ERR! Failed at the Vxmobile-ionic@ ionic:serve 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!     C:UsersshawangAppDataRoaming
    pm-cache\_logs2020-04-29T07_18_48_488Z-debug.log

    解决办法:

    修改package.json scripts ionic:serve

    ionic-app-scripts serve 后面添加 --max_old_space_size=8192

    {
      "name": "xxx",
      "author": "xxx",
      "homepage": "xxx",
      "private": true,
      "scripts": {
        "clean": "ionic-app-scripts clean",
        "build": "ionic-app-scripts build",
        "lint": "ionic-app-scripts lint",
        "ionic:build": "node copy-env-config.js --env prod | node --max-old-space-size=8192 ./node_modules/@ionic/app-scripts/bin/ionic-app-scripts.js build",
        "ionic:serve": "node copy-env-config.js --env dev | ionic-app-scripts serve --max_old_space_size=8192"
      },
      ...
    }

    4096不够的话就可以用8192试试

  • 相关阅读:
    Ubuntu安装gfortran
    Ubuntu12.04安装vscode i386
    PowerShell让系统可以执行.ps1文件
    Gitlab. Disable user creation on welcome page
    开源项目和工具列表
    布隆过滤器 (Bloom Filter)
    信息系统综合知识概览
    Hadoop实战之四~hadoop作业调度详解(2)
    Hadoop实战之三~ Hello World
    Hadoop实战之二~ hadoop作业调度详解(1)
  • 原文地址:https://www.cnblogs.com/cathy1024/p/12802462.html
Copyright © 2011-2022 走看看