如果你遇到如下的情况

<--- Last few GCs --->

[13724:0000020D39C660D0] 231298 ms: Mark-sweep 1356.3 (1433.6) -> 1356.3 (1433.6) MB, 1194.3 / 0.0 ms allocation failure GC in old space requested [13724:0000020D39C660D0] 232615 ms: Mark-sweep 1356.3 (1433.6) -> 1356.3 (1426.6) MB, 1198.3 / 0.0 ms last resort GC in old space requested [13724:0000020D39C660D0] 233976 ms: Mark-sweep 1356.3 (1426.6) -> 1356.3 (1426.6) MB, 1361.9 / 0.0 ms last resort GC in old space requested
==== JS stack trace ========================================= Security context: 000003D3AF3A5879 <JSObject>
1: forEachTrailingCommentToEmit(aka forEachTrailingCommentToEmit)
[D:\workspace\test5\node_modules\@angular-devkit\build- optimizer\node_modules\typescript\lib\typescript.js:~68706] [pc=0000011FBA279296](this=000002F7A0B022D1 <un
defined>,end=146101,cb=000002223F807211 <JSFunction
emitTrailingCommentOfPosition (sfi = 0000026706B3E149)>)
2: emitTrailingCommentsOfPosition(aka emitTrailingC... FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of
memory
1: node_module_register
2: v8::internal::FatalProcessOutOfMemory
3: v8::internal::FatalProcessOutOfMemory
4: v8::internal::Factory::NewCodeRaw
5: v8::internal::Factory::NewCode
6: v8::internal::modulo
7: v8::internal::compiler::ControlFlowOptimizer::TryBuildSwitch
8: v8::internal::ZoneVector<v8::internal::compiler::MoveOperands *
__ptr64>::ZoneVector<v8::internal::compiler::MoveOperands * __ptr64>
9: v8::internal::compiler::Pipeline::AllocateRegistersForTesting
10: v8::internal::compiler::ValueNumberingReducer::operator=
11: v8::internal::CompilationJob::FinalizeJob
12: v8::internal::compiler::InstructionSelector::isolate
13: v8::internal::Compiler::FinalizeCompilationJob
14: v8::internal::OptimizingCompileDispatcher::InstallOptimizedFunctions
15: v8::internal::StackGuard::HandleInterrupts
16: v8::internal::wasm::WasmOpcodes::TrapReasonMessage
17: 0000011FB84843C1

嗯,可以这么解决:

在package.json文件中做如下配置:

  "build-prod": "node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng build --prod"

然后打包的时候 :

npm run build-prod

ANGULAR 使用 ng build --prod 编译报内存错误的解决办法的更多相关文章

  1. android通过BitmapFactory.decodeFile获取图片bitmap报内存溢出的解决办法

    android通过BitmapFactory.decodeFile获取图片bitmap报内存溢出的解决办法 原方法: public static Bitmap getSmallBitmap(Strin ...

  2. 关于SSIS批量抽取Excel文件报0x80004005错误的解决办法

    原文:关于SSIS批量抽取Excel文件报0x80004005错误的解决办法 标题: Microsoft Visual Studio ------------------------------ Pa ...

  3. angular ng build --prod 打包报错解决方案

    使用以下代码  就不报错了 ng build --prod --no-extract-license    打包命令 使用以下代码  就不报错了 ng build --prod --no-extrac ...

  4. 在Linux下安装PHP过程中,编译时出现错误的解决办法

    在Linux下安装PHP过程中,编译时出现configure: error: libjpeg.(a|so) not found 错误的解决办法 configure: error: libjpeg.(a ...

  5. X265编译中C2220错误的解决办法

    x265编译过程中 C2220错误:根本原因是代码是英文代码页,而我们的操作系统中使用的是中文代码页: 解决办法1 逐个文件进行格式转换,我在ubuntu下用iconv命令试过,没成功: 解决办法2 ...

  6. 使用NDK r10构建Cocosd-x v3.2时编译和链接错误的解决办法

    如果你使用NDK r10构建Cocos2d-x v3.2,将会遇到所有测试用例编译错误以及Lua测试用例链接错误. 1. 编译错误 错误信息是: 1 2 3 4 5 6 7 8 /Users/ming ...

  7. 调式WP程序报0x80131500错误的解决办法

    在虚拟机上安装了win8系统和VS2013,但是在允许第一个WP程序时,居然报0x80131500错误信息,经查询原来是VS2013需更新的问题,如果你用的是VS2012,但是又系统升级到了win8. ...

  8. python 将mysql数据库中的int类型修改为NULL 报1366错误,解决办法

    gt.run_sql()是用pymysql 封装的类 distribution_sort_id type: int目的:将此字段值全部修改为NULL g=2gt.run_sql("updat ...

  9. Phalcon框架的编译安装 内存不足的解决办法

    对症解决 有两种解决方法,一种是提升ECS系统内存.但是却要真金白银跟阿里云去购买的.另一种,则是手动创建swap交换文件.下面来介绍第二种方法. 第一步:首先确定系统是否已经开启swap交换分区: ...

随机推荐

  1. MyBatis学习(二):与Spring整合(非注解方式配置MyBatis)

    搭建SpringMVC的-->传送门<-- 一.环境搭建: 目录结构: 引用的JAR包: 如果是Maven搭建的话,pom.xml的配置如下: <?xml version=" ...

  2. datatables参数配置详解

    //@translator codepiano //@blog codepiano //@email codepiano.li@gmail.com //尝试着翻译了一下,难免有错误的地方,欢迎发邮件告 ...

  3. 自动添加QQ

    自动添加QQ <meta http-equiv="refresh" content="0; url=tencent://AddContact/?fromId=50& ...

  4. javascript 返回上一页面

    <a href="<a href="javascript :history.back(-1)">返回上一页</a>或<a href=& ...

  5. mysql_num_rows

    mysql记录总条数 $sql3 = "select * from inviter where tuijianren = '$session' "; $res3 = mysql_q ...

  6. elk 日志分析系统Logstash+ElasticSearch+Kibana4

    elk 日志分析系统 Logstash+ElasticSearch+Kibana4 logstash 管理日志和事件的工具 ElasticSearch 搜索 Kibana4 功能强大的数据显示clie ...

  7. oracle 10g 数据库与客户端冲突导致实例创建无监听问题

    同事在oracle 10g上创建一个实例,快结束时弹出一个错误,提示监听失败之类.查看服务,并无生成监听服务.于是删除重来,一连试了好几次,都是如此. 这真是令人心烦意乱.提示里面有说到端口1521, ...

  8. Hadoop实战-MapReduce之WordCount(五)

    环境介绍: 主服务器ip:192.168.80.128(master)  NameNode  SecondaryNameNode ResourceManager 从服务器ip:192.168.80.1 ...

  9. 使用 QWorker 做为计划任务引擎

    QWorker 提供了 Plan 函数来提供计划任务功能的支持.每个任务做为一个作业,可以在指定的时间点被触发执行.而 cron 作为 Linux 操作系统下计划任务的标准被广大用户所熟知,QWork ...

  10. hdu 3415 单调队列

    Max Sum of Max-K-sub-sequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K ...