Run node-gyp commands from Grunt.

npm install grunt-node-gyp
2 downloads in the last day
15 downloads in the last week
201 downloads in the last month


Run node-gyp commands from Grunt.

Getting Started

This plugin requires Grunt ~0.4.0

If you haven’t used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you’re familiar with that process, you may install this plugin with this command:

$ npm install grunt-node-gyp --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:


For node-gyp to work you’ll have to install all necessary build tools for your platform, see node-gyp’s for that matter. However, you do not have to install node-gyp globally as it is already included with grunt-node-gyp.

The “gyp” task


In your project’s Gruntfile, add a section named gyp to the data object passed into grunt.initConfig().

  gyp: {
    options: {
      // Task-specific options go here.
    your_target: {
      // Target-specific file lists and/or options go here.



Type: String Default value: rebuild

Specify node-gyp command to execute.

Supported values are configure, build, clean and rebuild. See node-gyp’s for command descriptions.


Type: Boolean Default value: false

Create a debug build.

Usage Examples

Default Options

This would be equivalent to node-gyp rebuild.

$ grunt gyp:addon
  gyp: {
    addon: {}

Configure a debug build

This would be equivalent to node-gyp configure --debug.

$ grunt gyp:customTarget
  gyp: {
    customTarget: {
      command: 'configure',
      options: {
        debug: true

Running tests

First, install all dependencies:

$ npm install

Then run the tests:

$ grunt test

Testing might take a while as compiling takes time. You may need to install the node development header files before by executing:

$ ./node_modules/.bin/node-gyp install

Release History

  • v0.3.0: Update node-gyp to 0.13.x
  • v0.2.1: Hotfix because v0.2.0 didn’t include the main task file gyp.js
  • v0.2.0: Update node-gyp to 0.12.x
  • v0.1.0: Initial release


grunt-node-gyp is licensed under the BSD 2-clause license. See LICENSE for the full license.

npm loves you