"gulp --production", "failed": true, "rc": 2

Have recently updated Node/NPM and reading another thread that they had to set bower global, but this is about a gulp issue here. I got this error:

TASK [deploy : Run gulp] *************************************************************
System info:
  Ansible; Darwin
  Trellis at "Add `SKIP_GALAXY` env var to skip galaxy install in Vagrant"
[Errno 2] No such file or directory
fatal: [sub.domain.com]: FAILED! => {"changed": false, "cmd": "gulp --production", "failed": true, "rc": 2}
	to retry, use: --limit @/Users/jasper/webdesign/sub..domain.com/trellis/deploy.retry

So could be related but here gulp now fails. Any ideas how I can remedy this?

Well had to reinstall gulp globally and do the npm install again. Then somehow all the gulp needed packages did not get installed so had to do those manually using npm install -S package. Wonder if that happened as I installed gulp locally too… Anyways… Getting JSHint installed seems to be a real additional pain. Had to do a npm install jshint gulp-jshint --save-dev to get it installed and not run into 404s… Did get it installed in the end , but then I got:

[15:18:34] 'jshint' errored after 5.78 ms
[15:18:34] Error in plugin 'gulp-jshint'
    Invalid reporter
[15:18:34] 'build' errored after 2.71 s
[15:18:34] Error in plugin 'run-sequence(jshint)'
    at finish (/Users/jasper/webdesign/sub.domain.com/site/web/app/themes/ianua/node_modules/run-sequence/index.js:56:13)
    at Gulp.onError (/Users/jasper/webdesign/sub.domain.com/site/web/app/themes/ianua/node_modules/run-sequence/index.js:67:4)
    at emitOne (events.js:120:20)
    at Gulp.emit (events.js:210:7)
    at Gulp.Orchestrator._emitTaskDone (/Users/jasper/webdesign/sub.domain.com/site/web/app/themes/ianua/node_modules/orchestrator/index.js:264:8)
    at /Users/jasper/webdesign/sub.domain.com/site/web/app/themes/ianua/node_modules/orchestrator/index.js:275:23
    at finish (/Users/jasper/webdesign/sub.domain.com/site/web/app/themes/ianua/node_modules/orchestrator/lib/runTask.js:21:8)
    at module.exports (/Users/jasper/webdesign/sub.domain.com/site/web/app/themes/ianua/node_modules/orchestrator/lib/runTask.js:36:10)
    at Gulp.Orchestrator._runTask (/Users/jasper/webdesign/sub.domain.com/site/web/app/themes/ianua/node_modules/orchestrator/index.js:273:3)
    at Gulp.Orchestrator._runStep (/Users/jasper/webdesign/sub.domain.com/site/web/app/themes/ianua/node_modules/orchestrator/index.js:214:10)

But then I read here I needed to do a npm install -S jshint-stylish as well and then I was finally able to run gulp. And so then./bin/deploy.sh production sub.domain.com worked again as well.

I ran into the same / similar issue. I had been running Gulp 4 and ended up installing Gulp 3.9.1 - I also ran the same commands you listed. Gulp by itself ran fine, but I got this error again when running ‘gulp --production’.

It was solved by fixing any JS errors - then ran fine. Thanks for this!