grunt-rev icon indicating copy to clipboard operation
grunt-rev copied to clipboard

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

Open brandon-arnold opened this issue 9 years ago • 8 comments

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'
          ]
        }
      }
    },

brandon-arnold avatar Nov 26 '14 17:11 brandon-arnold

:+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.

jmaxxz avatar Dec 15 '14 05:12 jmaxxz

I have the same problem.

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

andrea-spotsoftware avatar Apr 28 '15 06:04 andrea-spotsoftware

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'
            ],

ianzepp avatar Jun 30 '15 14:06 ianzepp

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

elis avatar Sep 01 '15 13:09 elis

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

elis avatar Sep 01 '15 13:09 elis

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

brandon-arnold avatar Sep 01 '15 13:09 brandon-arnold

Yeah, and it solved the problem. Cheers!

On יום ג׳, 1 בספט׳ 2015 at 16:17 Brandon Arnold [email protected] 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.

elis avatar Sep 02 '15 22:09 elis

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

BenjaminConant avatar Sep 29 '15 19:09 BenjaminConant