1 错误

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[22:39:01] Using gulpfile G:\codeFolder\hexo-blog\lizhi\gulpfile.js
[22:39:01] Starting 'default'...
[22:39:01] Starting 'minify-html'...
[22:39:01] Starting 'minify-css'...
[22:39:01] Starting 'minify-js'...
[22:39:01] Starting 'minify-images'...
[22:39:02] 'minify-images' errored after 86 ms
[22:39:02] TypeError: imagemin.jpegtran is not a function
at G:\codeFolder\hexo-blog\lizhi\gulpfile.js:60:22
at minify-images (G:\codeFolder\hexo-blog\lizhi\node_modules\undertaker\lib\set-task.js:13:15)
at bound (domain.js:419:14)
at runBound (domain.js:432:12)
at asyncRunner (G:\codeFolder\hexo-blog\lizhi\node_modules\async-done\index.js:55:18)
at processTicksAndRejections (internal/process/task_queues.js:75:11)
[22:39:02] 'default' errored after 90 ms
[22:39:02] The following tasks did not complete: minify-html, minify-css, minify-js
[22:39:02] Did you forget to signal async completion?

2 解决方案

github答案
Had the same problem. The issue is you’re still calling imagemin.jpegtran in your config, which was replaced by imagemin.mozjpeg in v7.0.0.

// old
imagemin.jpegtran({
progressive: true,
}),

// new
imagemin.mozjpeg({
progressive: true,
}),
See also: 279a91b#diff-0730bb7c2e8f9ea2438b52e419dd86c9R36

写在最后

欢迎大家关注鄙人的公众号【麦田里的守望者zhg】,让我们一起成长,谢谢。
微信公众号