Thursday, 18 May 2017

Grunt livereload Fatal error: listen EACCES

I've been spending the latter part of my day learning about how to create my own gruntfile and add the various tasks I want to it. All has gone well so far but I'm trying to add the live reload feature in grunt-contrib-watch and running into some problems.

My localhost is listening to port 9080 so after reading through the documentation https://github.com/gruntjs/grunt-contrib-watch#optionslivereload

I figured this would make sense?

module.exports = function(grunt) {
require('jit-grunt')(grunt);
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    concat: {
      options: {
        separator: ';'
      },
      dist: {
        src: ['*.js', 'scripts/**/*.js'],
        dest: 'dist/<%= pkg.name %>.js'
      }
    },
    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
      },
      dist: {
        files: {
          'dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
        }
      }
    },
    jshint: {
      files: ['gruntfile.js', '*.js', 'scripts/**/*.js'],
      options: {
        // options here to override JSHint defaults
        globals: {
          jQuery: true,
          console: true,
          module: true,
          document: true
        }
      }
    },
    less: {
      development: {
        options: {
          compress: true,
          yuicompress: true,
          optimization: 2
        },
        files: {
          "css/main.css": "less/*.less" // destination file and source file
        }
      }
    },
    watch: {
      files: ['<%= jshint.files %>', 'less/**/*.less', '*.html', 'templates/**/*.html', 'data/**/*.json'],
      tasks: ['jshint', 'less'],
      options: {
        livereload: {
          host: 'localhost',
          port: 9080
        }
      }
    },
  });

  grunt.registerTask('default', ['jshint', 'concat', 'uglify', 'less', 'watch']);

};

I'm getting this error every time I try to save

Reloading watch config...

Running "watch" task Waiting... Fatal error: listen EACCES 127.0.0.1:9080

Can anyone shed any light on this?

Thanks



via pragmatic84

No comments:

Post a Comment