code: function(required, done) {
          if (arguments.length < 1 || required) {
            grunt.log.writeln('\nnpm install...');
            // Run npm install in project's directory
            grunt.util.spawn({cmd: 'npm', args: ['install'],
                              opts: {cwd: init.destpath, stdio: 'inherit'}},
                function(error, result, code) {
                  if (done) {
                    done();
                  }
                });
          } else if (done) {
            done();
          }
        }
docs: Run npm install in project's directory and then call done if it is specified. The first parameter allows to skip npm install if parameter's value is falsy (the default value is true).