Menu icon Foundation
[CLI] Error on foundation build @ image compression

Hi,

i got a problem when i try to use the foundation cli to build my project. I managed to isolate that the problem is while compressing the images.

Error message:

events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: spawn D:\...\node_modules\gulp-imagemin\node_modules\imagemin\node_modules\imagemin-jpegtran\node_modules\jpegtran-bin\vendor\jpegtran.exe ENOENT
    at exports._errnoException (util.js:746:11)
    at Process.ChildProcess._handle.onexit (child_process.js:1046:32)
    at child_process.js:1137:20
    at process._tickCallback (node.js:355:11)     

Only happens if using the --production flag

Greetings
Max

foundation 6clibuildproduction

Hi,

i got a problem when i try to use the foundation cli to build my project. I managed to isolate that the problem is while compressing the images.

Error message:

events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: spawn D:\...\node_modules\gulp-imagemin\node_modules\imagemin\node_modules\imagemin-jpegtran\node_modules\jpegtran-bin\vendor\jpegtran.exe ENOENT
    at exports._errnoException (util.js:746:11)
    at Process.ChildProcess._handle.onexit (child_process.js:1046:32)
    at child_process.js:1137:20
    at process._tickCallback (node.js:355:11)     

Only happens if using the --production flag

Greetings
Max

Rafi Benkual over 3 years ago

Hi Max,
Are you using SVG's images in your build? Not sure how the image compression works with SVG's but I know we made an exception for those in version 6.0.3 or so.

Max Audron over 3 years ago

It's a normal jpg file.

Jon Hurley over 3 years ago

I have the same issue. After much messing around, I have isolated it to imagemin. Doesn't matter whether I test a build with a single PNG or JPG it falls over at the same point.
```
> foundation-zurb-template@1.0.0 build D:\Projects\jct-corp
> gulp build --production

[16:44:40] Using gulpfile D:\Projects\jct-corp\gulpfile.js
[16:44:40] Starting 'build'...
[16:44:40] Starting 'clean'...
[16:44:40] Finished 'clean' after 19 ms
[16:44:40] Starting 'pages'...
[16:44:41] Starting 'sass'...
[16:44:42] Starting 'javascript'...
[16:44:43] Starting 'images'...
[16:44:43] Starting 'copy'...

events.js:141
throw er; // Unhandled 'error' event
^
Error: spawn D:\Projects\XXX\node_modules\gulp-imagemin\node_modules\image
min\node_modules\imagemin-jpegtran\node_modules\jpegtran-bin\vendor\jpegtran.exe
ENOENT
at exports._errnoException (util.js:856:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at nextTickCallbackWith2Args (node.js:478:9)
at process._tickCallback (node.js:392:17)
Error: foundation-zurb-template@1.0.0 build: gulp build --production
Exit status 1
at EventEmitter. (C:\Users\JMH\AppData\Roaming\npm\
node_modules\foundation-cli\node_modules\npm\lib\utils\lifecycle.js:214:16)
at emitTwo (events.js:87:13)
at EventEmitter.emit (events.js:172:7)
at ChildProcess. (C:\Users\JMH\AppData\Roaming\npm\
node_modules\foundation-cli\node_modules\npm\lib\utils\spawn.js:24:14)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:821:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
```

Rafi Benkual over 3 years ago

@Jon Hurley Weird! What did you do to get around that?