title: Automate npm and bower install with grunt
body: <p>I have a node / angular project that uses npm for backend dependency management and bower for frontend dependency management. I'd like to use a grunt task to do both install commands. I haven't been able to figure out how to do it.</p>
  
  <p>I made an attempt using <code>exec</code>, but it doesn't actually install anything.</p>
  
  <pre><code>module.exports = function(grunt) {
  
      grunt.registerTask('install', 'install the backend and frontend dependencies', function() {
          // adapted from http://www.dzone.com/snippets/execute-unix-command-nodejs
          var exec = require('child_process').exec,
              sys  = require('sys');
  
          function puts(error, stdout, stderr) { console.log(stdout); sys.puts(stdout) }
  
          // assuming this command is run from the root of the repo
          exec('bower install', {cwd: './frontend'}, puts);
      });
  
  };
  </code></pre>
  
  <p>When I <code>cd</code> into frontend, open up <code>node</code>, and run this code from the console, this works fine. What am I doing wrong in the grunt task?</p>
  
  <p>(I also tried to use the bower and npm APIs, but couldn't make that work either.)</p>