我的節點和NPM Vesrions低於一飲而盡圖像優化構建提供了錯誤
節點v6.9.1 NPM v3.10.9
我的代碼是
'use strict';
const gulp = require('gulp');
const imageop = require('gulp-image-optimization');
let dir = {
srcImages: 'public/wps/source/images',
build: 'public/wps/build/'
};
const config = {
src: dir.srcImages + '/**/*',
dest: dir.build + 'images/'
};
gulp.task('img-prod', function (cb) {
gulp.src(config.src).pipe(imageop({
optimizationLevel: 5,
progressive: true,
interlaced: true
})).pipe(gulp.dest(config.dest)).on('end', cb).on('error', cb);
});
當我做一飲而盡構建它會拋出一個錯誤
internal/child_process.js:289 var err = this._handle.spawn(options); ^
TypeError: Bad argument at TypeError (native) at ChildProcess.spawn (internal/child_process.js:289:26) at exports.spawn (child_process.js:380:9) at Imagemin._optimizeJpeg (/Users/sureshraju/xxx/Wps/web-pres/node_modules/image-min/imagemin.js:126:12) at Imagemin.optimize (/Users/sureshraju/xxxx/Wps/web-pres/node_modules/image-min/imagemin.js:57:26) at module.exports (/Users/sureshraju/xxxx/Wps/web-pres/node_modules/image-min/imagemin.js:179:21) at /Users/sureshraju/xxxx/Wps/web-pres/node_modules/gulp-image-optimization/index.js:38:17 at FSReqWrap.oncomplete (fs.js:123:15)
我還沒有測試過這個,但是嘗試將glob限制爲僅限圖像,而不是所有文件。 –
單獨使用圖像...並非所有文件 – Suresh
'/ **/*'表示所有文件。 –