The Issue:
when doing
npm install
You get the error:
? Request to https://raw.github.com/imagemin/jpegtran-bin/3.0.2/vendor/win/x64/jpegtran.exe failed
? jpegtran pre-build test failed
i compiling from source
× GotError: Request to http://downloads.sourceforge.net/project/libjpeg-turbo/1.4.0/libjpeg-turbo-1.4.0.tar.gz failed
at ClientRequest.<anonymous> (YourApp\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-jpegtran\node_modules\jpegtr
n-bin\node_modules\bin-build\node_modules\download\node_modules\got\index.js:177:7)
at ClientRequest.g (events.js:199:16)
at ClientRequest.emit (events.js:107:17)
at Socket.socketErrorListener (_http_client.js:271:9)
at Socket.emit (events.js:107:17)
at net.js:459:14
at process._tickCallback (node.js:355:11)
aused By: Error: read ECONNRESET
at exports._errnoException (util.js:746:11)
at TCP.onread (net.js:559:26)
gifsicle@3.0.1 postinstall YourApp\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-gifsicle\node_modules\gifsicle
node lib/install.js
? Request to https://raw.github.com/imagemin/gifsicle-bin/3.0.1/vendor/win/x64/gifsicle.exe failed
? gifsicle pre-build test failed
i compiling from source
× GotError: Request to http://www.lcdf.org/gifsicle/gifsicle-1.87.tar.gz failed
at ClientRequest.<anonymous> (YourApp\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-gifsicle\node_modules\gifsic
e\node_modules\bin-build\node_modules\download\node_modules\got\index.js:177:7)
at ClientRequest.g (events.js:199:16)
at ClientRequest.emit (events.js:107:17)
at Socket.socketErrorListener (_http_client.js:271:9)
at Socket.emit (events.js:107:17)
at net.js:459:14
at process._tickCallback (node.js:355:11)
aused By: Error: read ECONNRESET
at exports._errnoException (util.js:746:11)
at TCP.onread (net.js:559:26)
optipng-bin@3.0.2 postinstall YourApp\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-optipng\node_modules\optipng-b
n
node lib/install.js
? Request to https://raw.github.com/imagemin/optipng-bin/3.0.2/vendor/win/optipng.exe failed
? optipng pre-build test failed
i compiling from source
× GotError: Request to http://downloads.sourceforge.net/project/optipng/OptiPNG/optipng-0.7.5/optipng-0.7.5.tar.gz failed
at ClientRequest.<anonymous> (YourApp\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-optipng\node_modules\optipng
bin\node_modules\bin-build\node_modules\download\node_modules\got\index.js:177:7)
at ClientRequest.g (events.js:199:16)
at ClientRequest.emit (events.js:107:17)
at Socket.socketErrorListener (_http_client.js:271:9)
at Socket.emit (events.js:107:17)
at net.js:459:14
at process._tickCallback (node.js:355:11)
aused By: Error: read ECONNRESET
at exports._errnoException (util.js:746:11)
at TCP.onread (net.js:559:26)
The Reason:
grunt-contrib-imagemin cannot download and test 3 dependencies
imagemin-gifsicle
imagemin-optipng
imagemin-jpegtran
Solution
install grunt-contrib-imagemin 0.9.4 version
npm cache clear
npm uninstall grunt-contrib-imagemin
npm install --save-dev grunt-contrib-imagemin@.0.9.4
gifsicle
Download the gifsicle.exe 32 bit from here
unzip it
make a folder called vendor on yourapp\node_modules\grunt-contrib- imagemin\node_modules\imagemin\node_modules\imagemin-gifsicle\node_modules\gifsicle\
copy extracted gifsicle.exe to vendor folder
Now you have fixed the gifsicle issue. do not get exited two more to go :)
optipng
Download optipng.exe from here
make a folder called vendor on yourapp\node_modules\grunt-contrib- imagemin\node_modules\imagemin\node_modules\imagemin-optipng\node_module\optipng-bin\
copy extracted optipng.exe here.
Now you have fixed the optipng issue. do not get exited yet one more to go :)
jpegtran
Download jpegtran.exe and libjpeg-62.dll
put them in vendor folder inside
yourapp\node_modules\grunt-contrib- imagemin\node_modules\imagemin\node_modules\imagemin-jpegtran\node_module\jpegtran-bin\
Hooray, you are done. and your
Grunt imagemin:dist
command will be done successfully
Remember
if you install grunt again which is consequently will install grunt-contrib-imagemin these folders will not be overwritten. However for the first and clean installation you need to go through these steps.