@dmitriyanik

Скажите, в чем причина ошибки в gulp-imagemin?

[07:28:45] Error in plugin "gulp-imagemin"
        Message:
            spawn C:\dmitryanik\desktop\StroyTat\node_modules\gulp-imagemin\node_modules\optipng-bin\vendor\optipng.exe ENOENT
        Details:
            errno: ENOENT
            code: ENOENT
            syscall: spawn C:\dmitryanik\desktop\StroyTat\node_modules\gulp-imagemin\node_modules\optipng-bin\vendor\optipng.exe
            killed: false
            stdout:
            stderr: ""C:\dmitryanik\desktop\StroyTat\node_modules\gulp-imagemin\node_modules\optipng-bin\vendor\optipng.exe"" �� ���� ����७��� ��� ���譥�
        ��������, �ᯮ��塞�� �ணࠬ��� ��� ������ 䠩���.
        
            failed: true
            signal: null
            cmd: C:\dmitryanik\desktop\StroyTat\node_modules\gulp-imagemin\node_modules\optipng-bin\vendor\optipng.exe -strip all -clobber -o 3 -out C:\Users\AACE~1\AppData\Local\Temp\0241cda8-ac1c-42e6-a893-45ee354b6d21 -fix C:\Users\AACE~1\AppData\Local\Temp\60ead429-323a-464b-87f5-ef3485447771
            timedOut: false
            fileName: C:\dmitryanik\desktop\StroyTat\dist\img\calcRepairPrice\ourworks.png
            domainEmitter: [object Object]
            domainThrown: false
        
        [07:28:45] 'default' errored after 8.19 s


Мой gulpfile

import gulp from 'gulp';
import sync from 'browser-sync'; 
import imagemin from 'gulp-imagemin'; 
import fileInclude from 'gulp-file-include'; 
import {deleteAsync} from 'del'; 
import sass from 'sass'; 
import gulpSass from 'gulp-sass'; 
import autoprefixer from 'gulp-autoprefixer'; 
import clean_css from 'gulp-clean-css';
import rename from 'gulp-rename'; 

const browsersync = sync.create();
const scss = gulpSass(sass);      
    
let project_folder = 'dist',
    source_folder = 'src';

let path = {
    build: {
        html: project_folder + '/',
        css: project_folder + '/css/',
        img: project_folder + '/img/',
        icons: project_folder + '/icons/',
        fonts: project_folder + '/fonts/'
    },
    src: {
        html: [source_folder + '/html/*.html', '!' + source_folder + '/html/_*.html'], 
        css: source_folder + '/assets/sass/main.scss',
        img: source_folder + '/assets/img/**/*.+(png|jpg|gif|ico|svg|webp)',
        icons: source_folder + '/assets/icons/**/*.+(png|jpg|gif|ico|svg|webp)',
        fonts: source_folder + '/assets/fonts/*.woff'
    },
    watch: {
        html: source_folder + '/html/*.html',
        css: source_folder + '/assets/sass/*.scss',
        img: source_folder + '/assets/img/**/*.+(png|jpg|gif|ico|svg|webp)'
    },
    clean: './' + project_folder + '/'
};

export const browserSync = () => {
    browsersync.init({
        server: {
            baseDir: './' + project_folder + '/'
        },
        port: 3000,
        notify: false
    })
};

export const html = () => {
    return gulp.src(path.src.html)
           .pipe(fileInclude())
           .pipe(gulp.dest(path.build.html))
           .pipe(browsersync.stream());
};

export const watchFiles = () => {
    gulp.watch([path.watch.html], html);
    gulp.watch([path.watch.css], css);
    gulp.watch([path.watch.js], js);
    gulp.watch([path.watch.img], images);   
};

export const clean = () => {
    return deleteAsync(path.clean);
};

export const css = () => {
    return gulp.src(path.src.css)
           .pipe(
               scss({
                   outputStyle: 'expanded'
               })
           )
           .pipe(autoprefixer({
               overrideBrowserslist: ['last 5 versions'],
               cascade: true
           }))
           .pipe(gulp.dest(path.build.css))
           .pipe(clean_css())
           .pipe(rename({
               extname: ".min.css"
           }))
           .pipe(gulp.dest(path.build.css))
           .pipe(browsersync.stream());
};

export const images = () => {
    return gulp.src(path.src.img)
           .pipe(gulp.dest(path.build.img))
           .pipe(gulp.src(path.src.img))
           .pipe(imagemin())
           .pipe(gulp.dest(path.build.img))
           .pipe(browsersync.stream())
            .pipe(webp())
};
export const icons = () => {
    return gulp.src(path.src.icons)
           .pipe(gulp.dest(path.build.icons))
};

export let build = gulp.series(clean, gulp.parallel(html, css, images, icons));
let watches = gulp.parallel(build, watchFiles, browserSync);
export default watches;
  • Вопрос задан
  • 50 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы