node.js - 当我尝试缩小大量文件时,Gulp Imagemin“MaxBufferError:stdout maxBuffer exceeded”
问题描述
MaxBufferError: stdout maxBuffer exceeded
当我尝试缩小大量文件 (230) 时,Gulp Imagemin 错误。如果我一次缩小 40-50 个文件,它将运行任务。
如何增加缓冲区?还是停止任务中止?
节点版本 14.5,gulp 版本 4.0.2,gulp-imagemin 版本 7.1.0。
function imageMin(done) {
// Locate unprocessed images
return gulp.src('./src/assets/images/*')
// Optimise images and reduce file size, use gulp-cache to stop repeating
.pipe(cache(imagemin([
imagemin.gifsicle({interlaced: true, optimizationLevel: 3,}), // 1 to 3
imagemin.mozjpeg({quality: 90, progressive: true,}),
imagemin.optipng({optimizationLevel: 5,}), // 0 to 7
imagemin.svgo({
plugins: [{cleanupIDs: false,}]
})
],
// Shows files optimastion results in the terminal
{verbose: true }
)))
// Send optimised images to folder
.pipe(gulp.dest('./dist/assets/images')),
done();
}
解决方案
推荐阅读
- javascript - 将图像添加到工作表页眉/页脚 - Office JS - Excel
- azure - 当我尝试 git push 时出现此错误 | [ErrorException]:作曲家失败
- java - 使用 OpenJDK 时默认运行哪个 JVM?
- mongodb - 计算行数并仅获取 MongoDB 中的最后一行
- flutter - 带有 switch 的观察者:主体可能正常完成,导致返回“null”,但返回类型可能是不可为空的类型
- assembly - 是否有可能制作一个永远编写自己的汇编程序?
- node.js - express fileupload 包的路径问题
- python - 在我基于研究论文的 CNN 模型上获得可怕的准确性:~ 5%
- java - 使用 POM 和 PageObjectFactory 测试框架:使用 java 反射时出错
- android - 带有固定按钮的片段