Here’s what I did to resolve an error caused by imagemin when running gulp from the Sage theme directory.
Example: throw er; // Unhandled ‘error’ event
Uninstall imagemin node module (from main theme directory)
$ npm uninstall gulp-imagemin
Remove all images from the theme assets directory
Example: …/assets/images
Reinstall the gulp-imagemin node module at the version specified in your themes package.json file
Example: The package.son devDependencies requires: “gulp-imagemin”: “^2.3.0”,
$ npm install gulp-imagemin@2.3.0
Add a test image into the into the assets directory
Example: I added a .jpeg file because my specific error was for the imagemin-jpegtran node module.
Run a gulp command
$ gulp
Conclusion: This resolved the throw error imagemin error previously generated when running gulp from the main Sage theme directory.