33

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
Alpha
  • 7,586
  • 8
  • 59
  • 92
  • 1
    I am so glad you put the full text of the error in your question. Saved me quite a bit of trouble after I ingeniously decided to break my ruby configuration. – Patrick M Apr 08 '14 at 02:12

3 Answers3

57

*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!)

Alpha
  • 7,586
  • 8
  • 59
  • 92
  • 3
    I would also go so far as to say that you need your ruby installation's bin folder path appended to the global path environment variable. – JagWire Jan 03 '14 at 20:50
  • 3
    Is it just me, or does anybody else wonder why I should need to install ruby to use yeoman to set up a angular or ember project? – fool4jesus Jan 24 '14 at 20:46
  • 1
    @fool4jesus It's because Compass is written in Ruby. Would be nice if everything just ran with nodejs. I just wish there was a more helpful error message! – Scott Cornwell Jan 26 '14 at 23:06
  • @ScottCornwell Yeah, I figured that was the case. It just seems odd - and as you say the error message could definitely do with improvement. :-) – fool4jesus Jan 28 '14 at 01:10
  • add instructions to add the `gem` command e.g. `sudo apt-get install ruby` & `sudo apt-get install rubygems-integration` – Jossef Harush Kadouri Nov 21 '14 at 20:25
  • 1
    @JossefHarush The original question had the context of a Windows environment, which is just about downloading and executing an installer -- do you think it's useful to specify how to install ruby since there are several ways to go about it? – Alpha Nov 21 '14 at 21:57
  • Wait... why is Ruby / rubygems needed for yeoman / angular scaffolding? compass does... what? – Agent Zebra Jun 07 '15 at 05:14
4

On windows i had a few instalations of ruby:

    C:\ruby187

and

    C:\Ruby200-x64

install compass in both places, using:

    gem install compass

this resolve my issue on windows 8 64bit

Cybul
  • 71
  • 2
2

Following the same procedure for Ember, running grunt. Received the error "TypeError: Cannot read property 'stdout' of undefined." Did gem install compass (ruby had already been installed on my windows 7 64 bit) even though compass was supposed to be installed earlier and this worked. Ran grunt and grunt serve with no problems.

umbregachoong
  • 349
  • 1
  • 7
  • 21