Gulp - CALL_AND_RETRY_LAST 分配失败 - 进程内存不足 [英] Gulp - CALL_AND_RETRY_LAST Allocation failed - process out of memory

查看:13
本文介绍了Gulp - CALL_AND_RETRY_LAST 分配失败 - 进程内存不足的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

调用我的 gulp 任务之一时,我收到FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory".

When calling one of my gulp task, I get "FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory".

我在 这个问题中找到 我可以将参数传递给节点以增加默认内存限制:node --max-old-space-size=2000 server.js.但是我怎样才能告诉 gulp 将参数传递给 node.exe 呢?这是 标志列表 我可以传递给 gulp,我希望能找到一个gulp 在为任务启动节点时传递给节点.

I found in this question that I can pass a parameter to node to increase the default memory limit : node --max-old-space-size=2000 server.js. But how can I tell gulp to pass a parameter to node.exe ? Here is the list of flags I can pass to gulp, I was hoping to find one that gulp passes to node when it launches it for a task.

导致问题的任务:

var gulp = require('gulp');
var imagemin = require('gulp-imagemin');

gulp.task('imagemin', function() {
  var OUTPUT_FOLDER = '../Release_Prepared/';
  var extensionsToOptimize = ['gif', 'jpeg', 'jpg', 'png', 'svg'];
  var glob = [];

  for(var i=0; extensionsToOptimize.length; i++){
    glob.push(OUTPUT_FOLDER + '**/*.' + extensionsToOptimize[i]);
  }

  gulp.src(glob)
  .pipe(imagemin({
    verbose: true
  }))
  .pipe(gulp.dest(OUTPUT_FOLDER));
});

推荐答案

我今天才发现 gulp 可以被赋予任何 V8 选项,它会被传递给 node.例如,执行 gulp yourTask --max_old_space_size=2000 它会给你想要的结果.要查看要传递的 V8 标志列表,请在终端中键入 node --v8-options.

I just found out today that gulp can be given any V8 option and it will be passed to node. For example, do gulp yourTask --max_old_space_size=2000 and it will give you the results you want. To see a list of V8 flags to pass, type node --v8-options in your terminal.

这篇关于Gulp - CALL_AND_RETRY_LAST 分配失败 - 进程内存不足的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆