Problem:
while doing
npm install
You will receive an error message:
? 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)
Cause:
grunt-contrib-imagemin cannot load and test 3 dependencies
imagemin-gifsicle
imagemin-OptiPNG
imagemin-jpegtran
Decision
install version of grunt-contrib-imagemin 0.9.4
npm cache clear npm uninstall grunt-contrib-imagemin npm install
gifsicle
Download 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 the extracted gifsicle.exe file to the provider folder
You have now fixed the problem with gifsicle. don't leave two more to go :)
OptiPNG
Download optipng.exe from here create a folder called vendor on yourapp \ node_modules \ grunt-contrib-imagemin \ node_modules \ imagemin \ node_modules \ imagemin-optipng \ node_module \ optipng-bin \
Copy the extracted optipng.exe file here. You have now fixed the optipng problem. don't go out, another one to go :)
jpegtran
Download jpegtran.exe and libjpeg-62.dll place them in the provider folder inside
yourapp \ node_modules \ grunt-contrib-imagemin \ node_modules \ imagemin \ node_modules \ imagemin-jpegtran \ node_module \ jpegtran-bin \
Hooray, you're done. and yours
Grunt imagemin:dist
Command
will be successful
Remember
if you install grunt again, which therefore installs grunt-contrib-imagemin, these folders will not be overwritten. However, for a first and clean installation, you need to go through these steps.
source share