gulpgulp-imagemin

gulp-imagemin: error "pPipe(...) is not a function"


Running gulp-imagemin causes the following error:

/.../node_modules/imagemin/index.js:64
const pipe = opts.plugins.length > 0 ? pPipe(opts.plugins)(input) : Promise.resolve(input);
                                                          ^

TypeError: pPipe(...) is not a function

Source:

import plugins from 'gulp-load-plugins';
...
gulp.task('img:production', () =>
  gulp.src(`${config.dirs.src}/img/**/*`)
  .pipe(plugins().imagemin())
  .pipe(gulp.dest(`${config.dirs.dist}/img`))
);
...
gulp.task('build:production',
  [
   'img:production',
   'html:production',
   'css:production',
   'js:production',
   'copy',
   'critical',
  ],
);

Solution

  • This seems to be an issue with the current version of gulp-imagemin. But it should be fixed with the upcomming version, according to that issue: https://github.com/sindresorhus/gulp-imagemin/issues/261