环境:
- Windows 7的
- 节点 6.9.5
我使用这样的插件npm。但我得到一个错误。从一些视频来看,这是正确的。它与imagemin的版本有关吗?
// gulpfile.js
var gulp = require('gulp');
var imagemin = require('gulp-imagemin');
var app = {
srcPath: 'src/',
devPath: 'build/',
prdPath: 'dist/', //生产部署
}
gulp.task('image', function() {
gulp.src(app.srcPath + 'image/**/*')
.pipe(gulp.dest(app.devPath + 'image'))
.pipe(imagemin())
.pipe(gulp.dest(app.prdPath + 'image'))
})
当我“吞咽图像”时,出现错误:
[13:05:56] Using gulpfile ~\Desktop\study\angularapp\gulpfile.js
[13:05:56] Starting 'image'...
[13:05:56] Finished 'image' after 6.96 ms
[13:05:56] gulp-imagemin: Couldn't load default plugin "gifsicle"
[13:05:56] gulp-imagemin: Couldn't load default plugin "jpegtran"
[13:05:56] gulp-imagemin: Couldn't load default plugin "optipng"
[13:05:56] gulp-imagemin: Minified 1 image (saved 0 B - 0%)
我用过npm install imagemin-optipng
,还是不行。像这样的依赖:
"devDependencies": {
"clean-css": "^4.0.5",
"gulp": "^3.9.1",
"gulp-clean": "^0.3.2",
"gulp-concat": "^2.6.1",
"gulp-connect": "^5.0.0",
"gulp-cssmin": "^0.1.7",
"gulp-imagemin": "^3.1.1",
"gulp-less": "^3.3.0",
"gulp-load-plugins": "^1.5.0",
"gulp-uglify": "^2.0.1",
"lodash": "^4.17.4",
"open": "^0.0.5"
}
怎么了?