Node.js – Yeoman for Angular, then “grunt serve” won’t start

angularjsgruntjsnode.jsyeoman

This is the first time I use yeoman to setup the scaffolding for an AngularJS app, and I have to admit I am likely new to the nodeJS, grunt and bower world.

So, here's what I've done so far:

  • I made sure yeoman, grunt-cli and the angular-generator packages are installed

    npm install -g yo grunt-cli bower
    npm install -g generator-angular
    
  • Generated my app

    yo angular
    

    I also tried:

    yo angular --min-safe
    

So far, al seems good. Between the options given, I choose the Twitter Bootstrap one, no angular dependencies, and to overwrite my local .gitignore file.

After all that, I try to run my app:

grunt serve

At this point, grunt complains that it is not locally installed into the project, so I run:

npm install grunt --save-dev

No again, trying to run the app:

grunt serve

And this is where I get blocked:

C:\Projects\what-now>grunt serve
Running "serve" task

Running "clean:server" (clean) task

Running "concurrent:server" (concurrent) task

Running "copy:styles" (copy) task

Done, without errors.
    Warning:
    C:\Projects\what-now\node_modules\grunt-contrib-compass\node_modules\tmp\lib\tmp.js:261
      throw err;
            ^
    TypeError: Cannot read property 'stdout' of undefined
        at compile (C:\Projects\what-now\node_modules\grunt-contrib-compass\tasks\compass.js:37:10)
        at C:\Projects\what-now\node_modules\grunt-contrib-compass\tasks\compass.js:68:7
        at C:\Projects\what-now\node_modules\grunt-contrib-compass\tasks\lib\compass.js:121:11
        at _fileCreated (C:\Projects\what-now\node_modules\grunt-contrib-compass\node_modules\tmp\lib\tmp.js:172:7)
        at C:\Projects\what-now\node_modules\grunt-google-cdn\node_modules\bower\node_modules\rimraf\node_modules\graceful-fs\graceful-fs.js:53:5
        at C:\Projects\what-now\node_modules\grunt-google-cdn\node_modules\bower\node_modules\rimraf\node_modules\graceful-fs\graceful-fs.js:62:5
        at OpenReq.Req.done (C:\Projects\what-now\node_modules\grunt-google-cdn\node_modules\bower\node_modules\fstream\node_modules\graceful-fs\graceful-fs.js:142:5)
        at OpenReq.done (C:\Projects\what-now\node_modules\grunt-google-cdn\node_modules\bower\node_modules\fstream\node_modules\graceful-fs\graceful-fs.js:64:22)
        //... stack trace continues ...

Looking at the code that blows up in compass' compile method, what I find is the following:

child.stdout.pipe(process.stdout);

This makes me think that child is undefined for some reason, and this variable comes from a call to grunt.util.spawn. This is where I am at a loss.

Am I missing any dependency? Am I missing any configuration?

Info:

  • OS: Windows 8 x64
  • node: v0.10.22

Best Answer

*sighs*, sorry.

All it took me is to write this question to then figure out I needed to have installed Ruby and the compass gem. Now it makes sense: the process for compiling would not spawn up.

After installing Ruby, run:

gem install compass

And you should be good to go.

EDIT: After you install Ruby, you need to make sure that the ruby runtime files' path is added to your PATH variable. (Thanks JagWire!)

Related Topic