系统相关
首页 > 系统相关> > Angular Build 或Serve 内存溢出 CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

Angular Build 或Serve 内存溢出 CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

作者:互联网

方法一:设置环境变量

# windows
set NODE_OPTIONS=--max_old_space_size=4096
# mac/linux
export NODE_OPTIONS=--max_old_space_size=4096



方法二:在运行命令中增加 --max_old_space_size=4096

    例如可以修改 package.json 的 scripts 脚本,示例如下:

{
  "scripts": {
    "serve": "node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng serve",
    "prod": "node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng build --prod",
  }
}

标签:node,RETRY,old,space,--,max,JavaScript,LAST,size
来源: https://www.cnblogs.com/niewa0928/p/15879684.html