# Node error: throw errnoException(err, 'spawn');

**URL:** <https://discourse.roots.io/t/node-error-throw-errnoexception-err-spawn/5080>\
**Category:** sage\
**Created:** [October 20, 2015, 11:57pm UTC](https://discourse.roots.io/t/node-error-throw-errnoexception-err-spawn/5080 "2015-10-20T23:57:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sunil](https://discourse.roots.io/user_avatar/discourse.roots.io/sunil/32/6971_2.png) [@sunil](https://discourse.roots.io/u/sunil)\
**Post date:** [October 20, 2015, 11:57pm UTC](https://discourse.roots.io/t/node-error-throw-errnoexception-err-spawn/5080/1 "2015-10-20T23:57:50Z")

</div>

Running ‘gulp watch’ works fine.

However, when I run ‘gulp --production’ I get this dump:

```
child_process.js:1162
    throw errnoException(err, 'spawn');
          ^
Error: spawn EACCES
    at exports._errnoException (util.js:746:11)
    at ChildProcess.spawn (child_process.js:1162:11)
    at exports.spawn (child_process.js:995:9)
    at Through2._transform (/var/www/devserver/wp-content/themes/beautiful-solutions/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/imagemin-jpegtran/index.js:40:12)
    at Through2.Transform._read (/var/www/devserver/wp-content/themes/beautiful-solutions/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/imagemin-jpegtran/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:172:10)
    at Through2.Transform._write (/var/www/devserver/wp-content/themes/beautiful-solutions/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/imagemin-jpegtran/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:160:12)
    at doWrite (/var/www/devserver/wp-content/themes/beautiful-solutions/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/imagemin-jpegtran/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:326:12)
    at writeOrBuffer (/var/www/devserver/wp-content/themes/beautiful-solutions/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/imagemin-jpegtran/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:312:5)
    at Through2.Writable.write (/var/www/devserver/wp-content/themes/beautiful-solutions/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/imagemin-jpegtran/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:239:11)
    at write (/var/www/devserver/wp-content/themes/beautiful-solutions/node_modules/gulp-imagemin/node_modules/imagemin/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:623:24)

```

All I can figure out from it is that gulp-imagemin is erroring out. But I can’t tell anything much about the nature of the error from the dump.

The production run does return without errors if I remove the directory ‘images’ from my theme root.  
Right now this isn’t an issue, because I’m not loading any unique images for the theme. But eventually I expect to be adding images.

What could be going on, and how can I eliminate this error?
