我有一个问题,在我的代码中的任务。我有一些图像,我想转换他们从.jpg到.webp使用“gulp-webp”模块,但当我运行的gulp功能在终端上出现以下错误:
[00:00:00]Starting 'versionWebp'...
[00:00:00]'versionWebp' errored after 8.92 msTypeError: dest.on is not a function
[00:00:00]at DestroyableTransform.Readable.pipe (D:\Cursos\Curso 06\FestivalMusica_inicio\node_modules\readable-stream\lib\_stream_readable.js:564:8)
at versionWebp (D:\Cursos\Curso 06\FestivalMusica_inicio\gulpfile.js:60:10)
at taskWrapper (D:\Cursos\Curso 06\FestivalMusica_inicio\node_modules\undertaker\lib\set-task.js:13:15)
at bound (node:domain:421:15)
at runBound (node:domain:432:12)
at asyncRunner (D:\Cursos\Curso 06\FestivalMusica_inicio\node_modules\async-done\index.js:55:18)
at processTicksAndRejections (node:internal/process/task_queues:78:11).
我的密码是
const notify = require('gulp-notify');
const webp = require ('gulp-webp');
function versionWebp(){
return src('src/img/**/*')
.pipe( webp )
.pipe(gulp.dest('./build/img'))
.pipe(notify({message:'Version WEBP'}));
};
exports.versionWebp = versionWebp;
我希望你能帮助我。
1条答案
按热度按时间9jyewag01#
webp结尾必须有
()
,必须是函数;代码将为: