gulp-imagemin error: optipng: cannot execute binary file
我正在运行在计算机上安装了Gulp的项目。 运行Gulp Watch时,如果我向文件夹中添加新图像,我的gulp-imagemin会使进程崩溃。 我在该文件夹上正确设置了所有权限(已多次检查),并且图像也具有正确的权限。
该过程引发以下错误:
Error: Command failed:
/Users/robbert/Sites/wordpress_cyklo/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/imagemin-optipng/node_modules/optipng-bin/vendor/optipng
-strip all -clobber -force -fix -o 2 -out /var/folders/kj/wydtr_t92hqgymv2d2v43pjw0000gr/T/9ab534f4-267f-46cb-b99f-372028e6ed5b
/var/folders/kj/wydtr_t92hqgymv2d2v43pjw0000gr/T/eabb0414-f9db-4b6f-8242-4c8d25004e1d
/Users/robbert/Sites/wordpress_cyklo/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/imagemin-optipng/node_modules/optipng-bin/vendor/optipng:
/Users/robbert/Sites/wordpress_cyklo/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/imagemin-optipng/node_modules/optipng-bin/vendor/optipng:
cannot execute binary file
每当我在文件夹上运行Gulp时,都会出现相同的错误,除非通过Vagrant VM运行它。 我该如何解决? 我的VM慢很多,所以我真的希望能够在主操作系统上运行Gulp。
编辑:这是图像的吞噬:
1 2 3 4 5 6 7 8 9 10 11 12 | // ### Images // `gulp images` - Run lossless compression on all the images. gulp.task('images', function() { return gulp.src(globs.images) .pipe(imagemin({ progressive: true, interlaced: true, svgoPlugins: [{removeUnknownsAndDefaults: false}, {cleanupIDs: false}] })) .pipe(gulp.dest(path.dist + 'images')) .pipe(browserSync.stream()); }); |
如果您在一个系统(例如Linux)上运行
即使您未显式复制项目,但无意中将
最好的选择是从头开始删除整个
1 2 | rm -rf node_modules npm install |