Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPERM: operation not permitted, open on second run of task. First run of task terminated with code 0 #31

Open
jclarkcds opened this issue Feb 15, 2022 · 1 comment

Comments

@jclarkcds
Copy link

I'm using gulp-webp to optimize images in a .net MVC 5.2.7 project.

gulpfile.js:

var gulp = require('gulp');
var gulpSass = require('gulp-sass');
var csso = require('gulp-csso');
var webp = require('gulp-webp');
gulpSass.complier = require('dart-sass');
gulp.task('compile-sass', function () {
    return gulp.src('./src/custom.scss')
        .pipe(gulpSass()).pipe(csso()).pipe(gulp.dest('./Content'));
});

//This task will create *.webp compressed images from the jpgs and pngs in the images folder.
gulp.task('convert-webp', function () {
    return gulp.src('images/*/*.{jpg,png}')
        .pipe(webp({ quality: 50 }))
        .pipe(gulp.dest('images', { overwrite: true }))
});

On my first run of task 'convert-webp':

[06:53:47] Using gulpfile ~\source\Workspaces\xxx\xxx\Gulpfile.js
[06:53:47] Starting 'convert-webp'...
[06:53:58] Finished 'convert-webp' after 11 s
Process terminated with code 0.
On any subsequent run of task 'convert-webp':
[07:00:28] Using gulpfile ~\source\Workspaces\xxx\xxx\Gulpfile.js
[07:00:28] Starting 'convert-webp'...
[07:00:29] 'convert-webp' errored after 606 ms
[07:00:29] Error: EPERM: operation not permitted, open C:\Users\jclark\source\Workspaces\xxx\xxx\images\logo\logo1.webp'
All the permission's are correct. If I delete *.webp, the task completes with terminated return code 0.

Can I get some direction to a solution?

@supremeliuao
Copy link

I had the same problem in my project

my config

const { src: SRC, dest: DEST } = require('gulp');
const WEBP = require('gulp-webp');

function defaultTask() {
return SRC('imgs/**/*.{png,jpg}').pipe(WEBP()).pipe(DEST('output/imgs'))
}

exports.default = defaultTask;

my error

[17:58:20] Using gulpfile E:\iyouTest\gulp\gulpfile.js
[17:58:20] Starting 'default'...
[17:58:20] 'default' errored after 125 ms
[17:58:20] Error in plugin "gulp-webp"
Message:
ϵͳ�Ҳ���ָ����·����

Details:
errno: ENOENT
code: ENOENT
syscall: spawn E:\iyouTest\gulp\node_modules\cwebp-bin\vendor\cwebp.exe
killed: false
stdout:
stderr: ϵͳ�Ҳ���ָ����·����

failed: true
signal: null
cmd: E:\iyouTest\gulp\node_modules\cwebp-bin\vendor\cwebp.exe -quiet -mt -o C:\Users\admin\AppData\Local\Temp\73db35a7-f35f-4ef2-8427-c20b24ecbbdd C:\Users\admin\AppData\Local\Temp\c471593d-918a-485e-84d2-bd8ef1082d88
timedOut: false
fileName: E:\iyouTest\gulp\imgs\advertisement.png
domainEmitter: [object Object]
domainThrown: false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants