gruntjs / grunt-contrib-watch

Run tasks whenever watched files change.
http://gruntjs.com/
MIT License
1.98k stars 356 forks source link

Fatal error: EACCES, readdir XXX #54

Closed alejandroiglesias closed 11 years ago

alejandroiglesias commented 11 years ago

I've been getting strange EACCESS errors when trying to run grunt watch.

Fatal error: EACCES, readdir '/tmp/launchd-4643.AHyaSD'

Another example:

Fatal error: EACCES, readdir '/var/agentx'

Here is a full grunt watch --verbose:

Initializing
Command-line options: --verbose

Reading "Gruntfile.js" Gruntfile...OK

Registering Gruntfile tasks.
Reading package.json...OK
Parsing package.json...OK
Initializing config...OK

Registering "grunt-contrib-concat" local Npm module tasks.
Reading /Users/alejandro/Development/socure/node_modules/grunt-contrib-concat/package.json...OK
Parsing /Users/alejandro/Development/socure/node_modules/grunt-contrib-concat/package.json...OK
Loading "concat.js" tasks...OK
+ concat

Registering "grunt-contrib-uglify" local Npm module tasks.
Reading /Users/alejandro/Development/socure/node_modules/grunt-contrib-uglify/package.json...OK
Parsing /Users/alejandro/Development/socure/node_modules/grunt-contrib-uglify/package.json...OK
Loading "uglify.js" tasks...OK
+ uglify

Registering "grunt-contrib-jshint" local Npm module tasks.
Reading /Users/alejandro/Development/socure/node_modules/grunt-contrib-jshint/package.json...OK
Parsing /Users/alejandro/Development/socure/node_modules/grunt-contrib-jshint/package.json...OK
Loading "jshint.js" tasks...OK
+ jshint

Registering "grunt-contrib-watch" local Npm module tasks.
Reading /Users/alejandro/Development/socure/node_modules/grunt-contrib-watch/package.json...OK
Parsing /Users/alejandro/Development/socure/node_modules/grunt-contrib-watch/package.json...OK
Loading "watch.js" tasks...OK
+ watch

Registering "grunt-contrib-compass" local Npm module tasks.
Reading /Users/alejandro/Development/socure/node_modules/grunt-contrib-compass/package.json...OK
Parsing /Users/alejandro/Development/socure/node_modules/grunt-contrib-compass/package.json...OK
Loading "compass.js" tasks...OK
+ compass
Loading "Gruntfile.js" tasks...OK
+ default

Running tasks: watch

Running "watch" task
Verifying property watch exists in config...OK
Verifying properties watch.gruntfile.files, watch.gruntfile.tasks exist in config...OK
Verifying properties watch.lib_test.files, watch.lib_test.tasks exist in config...OK
Verifying properties watch.styles.files, watch.styles.tasks exist in config...OK
Waiting...Fatal error: EACCES, readdir '/var/agentx'

grunt --version output:

grunt-cli v0.1.6
grunt v0.4.0

This doesn't happens when running just grunt. Any clues about this? This started happening since upgrading to 0.4.

shama commented 11 years ago

EACCES means node doesn't have permission to read that directory. Probably just need to tighten up your file matching rules to only files you have permission to or run grunt as a user with adequate permissions.

alejandroiglesias commented 11 years ago

But /var/agentx is not a file I manually specified in the Gruntfile nor is it /tmp/launchd-4643.AHyaSD. Where does those come from?

shama commented 11 years ago

Could you post your gruntfile?

alejandroiglesias commented 11 years ago
/*global module:false*/
module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    // Metadata.
    pkg: grunt.file.readJSON('package.json'),
    banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
      '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
      '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
      '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
      ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
    // Task configuration.
    concat: {
      options: {
        banner: '<%= banner %>',
        stripBanners: true
      },
      dist: {
        src: ['js/src/**/*.js'],
        dest: 'js/build/<%= pkg.name %>.js'
      }
    },
    uglify: {
      options: {
        banner: '<%= banner %>'
      },
      dist: {
        src: '<%= concat.dist.dest %>',
        dest: 'js/build/<%= pkg.name %>.min.js'
      }
    },
    jshint: {
      options: {
        curly: true,
        eqeqeq: true,
        immed: true,
        latedef: true,
        newcap: true,
        noarg: true,
        sub: true,
        undef: true,
        unused: true,
        boss: true,
        eqnull: true,
        browser: true,
        globals: {}
      },
      gruntfile: {
        src: 'Gruntfile.js'
      },
      lib_test: {
        src: ['lib/**/*.js', 'test/**/*.js']
      }
    },
    // qunit: {
    //   files: ['test/**/*.html']
    // },
    watch: {
      gruntfile: {
        files: '<%= jshint.gruntfile.src %>',
        tasks: ['jshint:gruntfile']
      },
      lib_test: {
        files: '<%= jshint.lib_test.src %>',
        tasks: ['jshint:lib_test'/*, 'qunit'*/]
      },
      styles: {
        files: '<%= compass.compile.sassDir %>/**/*.scss',
        tasks: ['compass:dev']
      }
    },
    compass: {
      compile: {
        options: {
          sassDir: 'scss',
          cssDir: 'styles',
          specify: ['scss/landing.scss', 'scss/login.scss', 'scss/app.scss'],
          imagesDir: 'images',
          environment: 'production',
          outputStyle: 'compressed',
          relativeAssets: true,
          force: true
        }
      },
      dev: {
        options: {
          sassDir: '<%= compass.compile.sassDir %>',
          cssDir: '<%= compass.compile.cssDir %>',
          specify: '<%= compass.compile.specify %>',
          imagesDir: '<%= compass.compile.imagesDir %>',
          environment: 'development',
          outputStyle: 'compact',
          relativeAssets: true,
          debugInfo: true,
          force: true
        }
      }
    }
  });

  // These plugins provide necessary tasks.
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  // grunt.loadNpmTasks('grunt-contrib-nodeunit');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-compass');

  // Default task.
  grunt.registerTask('default', ['jshint', /*'qunit',*/ 'concat', 'uglify', 'compass:compile']);

};
shama commented 11 years ago

Hmm that is strange. Are there any symlink'd directories? It should be bothering with /var/ or /tmp/.

alejandroiglesias commented 11 years ago

Nope, running ls -lR /path/to/folder | grep ^l didn't revealed any.

alejandroiglesias commented 11 years ago

Ok, just found it commenting around things.

Line files: '<%= compass.compile.sassDir %>/**/*.scss', should be: files: '<%= compass.compile.options.sassDir %>/**/*.scss',

My mistake! But the error message is still strange... Thanks a lot for your help!

shama commented 11 years ago

Very strange but glad you found the solution!

4lador commented 8 years ago

Check if you're working with a linux filesystem where you can arrange permissions that way (not NTFS for example)