Search code examples
angularjsmacosnpmgulpyeoman-generator

Yeoman/Gulp throwing 'spawn gulp ENOENT' error on a Mac


Please note: I do see this question as well as this one but those were both instances where the developer was on Windows, and the solution was Windows-specific. I am on a Mac! Please don't closevote as a duplicate!!!


Mac 10.12.6 here. I'm new to AngularJS (v1.x) and am trying to follow this tutorial on using Yeoman to create an internationalized AngularJS app.

I install the Yeoman AngularJS generator and create a directory for my simple/test app:

npm install -g generator-angular
mkdir angular-translate-yeoman && cd $_

Then I go to create my internationalization AngularJS app:

yo angular translate

It asks me a bunch of questions, I select gulp instead of grunt, and then starts generating the scaffolding. About a minute later I get the following error:

events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: spawn gulp ENOENT
    at exports._errnoException (util.js:1020:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
    at onErrorNT (internal/child_process.js:367:16)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)

Anybody have any idea what the problem is and what the fix is?


Solution

  • I'm leaving this question up rather than deleting it. The problem was that I didn't have gulp installed, and the tutorial I was using never bothered to mentioned installing gulp as a pre-requisite. Not knowing anything about Yeoman, I guess I figured it would install any JS dependencies for me.

    So this is the error you'll receive when you're on a Mac and using Yeoman + Gulp together, but Gulp isn't installed on your machine. To install Gulp:

    npm install gulp-cli -g
    npm install gulp -D
    touch gulpfile.js
    gulp --help