gulp-nodemon: Object # has no method ‘spawnSync’

gulp-nodemon is a nice tool if you want to restart your node process when your source code changes. It is very easy to use. Just take this snippet from their sample code and modify the script to your needs.

gulp.task('develop', function () {
  nodemon({ script: 'server.js'
          , ext: 'html js'
          , ignore: ['ignored.js']
          , tasks: ['lint'] })
    .on('restart', function () {
      console.log('restarted!')
    })
})

Just fire up “gulp develop” and the server will start.

You might receive the following error: Object #<Object> has no method ‘spawnSync’

In this case check your node version (e.g. mine was 0.10.26). As stated in the release notes (here) you need to use Node.js version 0.12 in order to use it. You either use an older version of gulp-nodemon or upgrade your Node.js installation to the correct version.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s