sebdeckers / grunt-rev

:punch: Asset revving for Grunt.js
MIT License
240 stars 54 forks source link

Error: Unable to read .js file (Error code: EISDIR). #29

Open brandon-arnold opened 9 years ago

brandon-arnold commented 9 years ago

Hi all,

It seems the grunt rev section in its current form can't distinguish between a directory ending in ".js" and a .js file. Grunt-rev (and subsequently usemin) will fail with

Warning: Unable to read "dist/public/bower_components/spin.js" file (Error code:
 EISDIR). Use --force to continue.

Aborted due to warnings.

In the below Gruntfile.js section, I fixed the problem by singling out each .js/ directory (spin.js is a project name and a .js file, for example) and excluding it. If you can tell me a more general way to do it by regex I would appreciate it.

    // Renames files for browser caching purposes
    rev: {
      dist: {
        files: {
            src: [
                '<%= yeoman.dist %>/public/**/*.js',
                '<%= yeoman.dist %>/public/**/*.css',
                '<%= yeoman.dist %>/public/assets/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
                '<%= yeoman.dist %>/public/assets/fonts/{,*/}*.ttf',
                '!<%= yeoman.dist %>/public/bower_components/openlayers/tests/node.js',
                '!<%= yeoman.dist %>/public/bower_components/spin.js'
          ]
        }
      }
    },
jmaxxz commented 9 years ago

:+1: this problem history.js is the package causing me issues.

Thanks @brandon-arnold your solution saved me from choosing between a library I use and a working build.

andrea-spotsoftware commented 9 years ago

I have the same problem.

Anyway thank you @brandon-arnold you saved me also!

ianzepp commented 9 years ago

Note: I ran into this issue with the Auth0 module also:

Warning: Unable to read "dist/public/bower_components/auth0.js" file (Error code: EISDIR). Use --force to continue.

The solution above for spin.js also fixes the auth0.js problem. You may also need to do the same fix in the 'usemin' configuration section as well, if you have one:

        usemin: {
            html: ['<%= yeoman.dist %>/public/{,*/}*.html'],
            css: ['<%= yeoman.dist %>/public/{,*/}*.css'],
            js: [
                '<%= yeoman.dist %>/public/{,*/}*.js',
                '!<%= yeoman.dist %>/public/bower_components/auth0.js'
            ],
elis commented 9 years ago

Any package that ends with .js will produce this error.

elis commented 9 years ago

@ianzepp Your solution doesn't resolve the issue for me.

brandon-arnold commented 9 years ago

@elis: did you add the line to the rev {} section, too, like the first post? Ianzepp only showed half the solution.

elis commented 9 years ago

Yeah, and it solved the problem. Cheers!

On יום ג׳, 1 בספט׳ 2015 at 16:17 Brandon Arnold notifications@github.com wrote:

@elis https://github.com/elis: did you add the line to the rev {} section, too, like the first post? Ianzepp only showed half the solution.

— Reply to this email directly or view it on GitHub https://github.com/cbas/grunt-rev/issues/29#issuecomment-136716352.

BenjaminConant commented 9 years ago

Worked like a charm... and really good to know!