gulp-imagemin relies on optipng to optimize PNG images. optipng is a native program written in C, not JavaScript. This means that with npm install gulp-imagemin , the corresponding optipng executable is optipng for your system architecture.
If you run npm install gulp-imagemin on one system (e.g. Linux) and then copy the entire project, including the node_modules folder, to another system (e.g. MacOS X), the optipng executable will still be for Linux. MacOS X cannot run Linux executables.
The same problem can occur even if you do not explicitly copy the project, but accidentally copy the node_modules folder to your repository.
Your best option is to delete the entire node_modules and npm install folder from scratch:
rm -rf node_modules npm install
Sven schoenung
source share