Error compressing picture with gulp

gulp.task("testImagemin", function () {
    return gulp.src("./images/*.*")
        .pipe(imagemin({
            optimizationLevel: 5, //:Number  :3  :0-7
            progressive: true, //:Boolean :false jpg
            interlaced: true, //:Boolean :false gif
            multipass: true //:Boolean :false svg
        }))
        .pipe(gulp.dest("build/images"));
});

my side of gulp will only have this kind of error all the time. Does anyone know why? I have also reinstalled the plug-in several times, all like this

clipboard.png

if I remove the .pipe (imagemin ()), image and normally output it to the build folder, but after adding it, I will report an error.

Mar.03,2021

is likely to be installed at the time of installation, this plug-in is not installed. I am installing this plug-in, it has been many times, there is a problem, installing other plug-ins is fine.


check your configuration and image path carefully to see if there is something wrong with it. Generally speaking, such errors are not the problem of plug-ins


1, whether to refer to imagemin = require ('gulp-imagemin')
2, Whether the image path is wrong


may be a problem with the picture path. Try to find another way


to see if there are files in the images folder that are not in picture format.


I have tried a lot of methods. None of it has been solved.
waited two days to uninstall gulp, reinstall it, and then be fine. I'm in a good mood!


nothing wrong, either gulp's own pit, or there is a problem with the picture


how did the landlord solve this problem? I also encountered this problem

Menu