Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flow.js causes build error (Warning: Unable to read "dist/public/bower_components/flow.js" file (Error code: EISDIR)) #1064

Closed
thehashrocket opened this issue Jul 15, 2015 · 15 comments

Comments

@thehashrocket
Copy link

Is there a process for resolving or getting around this issue: Warning: Unable to read "dist/public/bower_components/flow.js" file (Error code: EISDIR)

The only one I've found that works is is a workaround. But I still have to use --force in order to get it to build and deploy correctly.

EDIT: the other problem is, even with this fix, you have to run grunt build --force in order for it to work. :/

@kingcody
Copy link
Member

@jshultz which task is failing? Small log post please?

@thehashrocket
Copy link
Author

Sure, here you go:

Running "usemin:js" (usemin) task

Processing as JS - dist/public/app/8d8978e0.vendor.js
Update the JS to reference our revved images

Processing as JS - dist/public/app/e60d0032.app.js
Update the JS to reference our revved images

Processing as JS - dist/public/bower_components/flow.js
Warning: EISDIR, illegal operation on a directory Used --force, continuing.

@kingcody
Copy link
Member

@jshultz can you try something for me?
Can you change your original rev block in Gruntfile.js from:

    rev: {
      dist: {
        files: {
          src: [
            '<%= yeoman.dist %>/client/{,*/}*.js',
            '<%= yeoman.dist %>/client/{,*/}*.css',
            '<%= yeoman.dist %>/client/assets/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
            '<%= yeoman.dist %>/client/assets/fonts/*'
          ]
        }
      }
    },

to this:

    rev: {
      dist: {
        files: {
          src: [
            '<%= yeoman.dist %>/client/!(bower_components)/{,*/}*.js',
            '<%= yeoman.dist %>/client/!(bower_components)/{,*/}*.css',
            '<%= yeoman.dist %>/client/assets/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
            '<%= yeoman.dist %>/client/assets/fonts/*'
          ]
        }
      }
    },

@thehashrocket
Copy link
Author

Mine doesn't look like that? Mine looks like:

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

@kingcody
Copy link
Member

Sorry, that was my mistake (copying from the wrong branch).

How about changing it to this:

    rev: {
      dist: {
        files: {
          src: [
            '<%= yeoman.dist %>/public/!(bower_components)/{,*/}*.js',
            '<%= yeoman.dist %>/public/!(bower_components)/{,*/}*.css',
            '<%= yeoman.dist %>/public/assets/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
            '<%= yeoman.dist %>/public/assets/fonts/*'
          ]
        }
      }
    },

(same concept just replace client with public)

@thehashrocket
Copy link
Author

No worries, I've been there before.

So, I tried that and:


// Renames files for browser caching purposes
    rev: {
      dist: {
        files: {
          src: [
            '<%= yeoman.dist %>/public/!(bower_components)/{,*/}*.js',
            '<%= yeoman.dist %>/public/!(bower_components)/{,*/}*.css',
            '<%= yeoman.dist %>/public/assets/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
            '<%= yeoman.dist %>/public/assets/fonts/*'
          ]
        }
      }
    },

resulting in:


Processing as JS - dist/public/bower_components/flow.js
Warning: EISDIR, illegal operation on a directory Use --force to continue.

@kingcody
Copy link
Member

Well, that seemed to fix the issue on code generated by the canary branch. Let me see if I can reproduce on the master branch.

@thehashrocket
Copy link
Author

can I update an existing application that's already built to the latest version? I'm not sure how that works. I'll let you figure out the first issue first, though. :)

@kingcody
Copy link
Member

As far as that goes, there isn't a clear upgrade path for migrating an existing app.

@thehashrocket
Copy link
Author

ok, no biggie I can make that work pretty easy. :)

@kingcody
Copy link
Member

Ok, well #1064 (comment) got us a little bit closer. That excluded bower_components from the rev block.

Now we just need to do the same for the usemin block:

    usemin: {
      html: ['<%= yeoman.dist %>/public/!(bower_components)/{,*/}*.html'],
      css: ['<%= yeoman.dist %>/public/!(bower_components)/{,*/}*.css'],
      js: ['<%= yeoman.dist %>/public/!(bower_components)/{,*/}*.js'],
      ...
    },

I think its safe to say that we don't need usemin rewriting asset references in our bower dependencies (:

@thehashrocket
Copy link
Author

Guess what? That fixed all the things! :) Awesome! :)

@kingcody
Copy link
Member

@jshultz I'd like to share an interesting tidbit with you.

There is a newer version of grunt-usemin in canary and they have fixed the problem in their module (which is why I didn't have the usemin issue when testing canary branch). However like I said, I feel that we should probably exclude the bower_components folder anyways.

The other thing is that there is a newer (more maintained) module called grunt-filerev which does the same task as grunt-rev and they have also fixed this issue in their module as well.

@thehashrocket
Copy link
Author

ok, cool. thanks for the heads up. :)

@adamjaffeback
Copy link

Also useful: this is an issue with an folder which has .js in the file name. Examples include, Chart.js, flow.js, etc.

Solution from sebdeckers/grunt-rev#29 (comment):

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants