juanfran / gulp-jade-inheritance

Gulp plugin to rebuild jade files and other files that have extended or included those files
34 stars 32 forks source link

Illegal operation on a directory, read #12

Closed danieldafoe closed 8 years ago

danieldafoe commented 8 years ago

I'm experiencing some difficulty with this module and I'd really appreciate any help. Here is my task:

gulp.task('templates-dev', function() {
    gulp.src('./app/jade/templates/*.jade')
        .pipe(jadeInheritance({baseDir: './app/jade/'}))
        .pipe(jade({
            locals: './app/jade/',
            pretty: true
        }))
        .pipe(gulp.dest('./dev/'))
});

And the output I'm getting is:

stream.js:74
      throw er; // Unhandled stream error in pipe.
      ^
Error: EISDIR: illegal operation on a directory, read
    at Error (native)
    at Object.fs.readSync (fs.js:603:19)
    at Object.fs.readSync (/Users/danieldafoe/Desktop/folder/node_modules/gulp-cssmin/node_modules/graceful-fs/polyfills.js:218:23)
    at Object.fs.readFileSync (fs.js:438:24)
    at _fn (/Users/danieldafoe/Desktop/folder/node_modules/jade-inheritance/lib/parser.js:52:50)
    at Parser.getInheritance (/Users/danieldafoe/Desktop/folder/node_modules/jade-inheritance/lib/parser.js:100:9)
    at _fn (/Users/danieldafoe/Desktop/folder/node_modules/jade-inheritance/lib/parser.js:81:71)
    at Parser.getInheritance (/Users/danieldafoe/Desktop/folder/node_modules/jade-inheritance/lib/parser.js:100:9)
    at new Parser (/Users/danieldafoe/Desktop/folder/node_modules/jade-inheritance/lib/parser.js:24:24)
    at new JadeInheritance (/Users/danieldafoe/Desktop/folder/node_modules/jade-inheritance/lib/index.js:10:16)
    at /Users/danieldafoe/Desktop/folder/node_modules/gulp-jade-inheritance/index.js:34:33
    at arrayEach (/Users/danieldafoe/Desktop/folder/node_modules/gulp-jade-inheritance/node_modules/lodash/index.js:1289:13)
    at Function.<anonymous> (/Users/danieldafoe/Desktop/folder/node_modules/gulp-jade-inheritance/node_modules/lodash/index.js:3345:13)
    at Stream.endStream (/Users/danieldafoe/Desktop/folder/node_modules/gulp-jade-inheritance/index.js:32:9)
    at _end (/Users/danieldafoe/Desktop/folder/node_modules/gulp-jade-inheritance/node_modules/event-stream/node_modules/through/index.js:65:9)
    at Stream.stream.end (/Users/danieldafoe/Desktop/folder/node_modules/gulp-jade-inheritance/node_modules/event-stream/node_modules/through/index.js:74:5)

I'm just unsure which "directory" the illegal operation is happening in. This only happens when I insert my pipe with gulp-jade-inheritance.

juanfran commented 8 years ago

Something strange going through the pipe, I don't undestand the line about gulp-cssmin

Could you add a console.log in /Users/danieldafoe/Desktop/folder/node_modules/jade-inheritance´/lib/parser.js in the line 52 before the fs.readFileSync?, like this

        } else {
          console.log(file);
          string = _this.cache[file].string = fs.readFileSync(file, 'utf8');
        }

thanks

danieldafoe commented 8 years ago

Thank you for replying, @juanfran .

So, it seems like the log outputs all of the jade files--regardless of whether they're dependencies or not. (Though, I'm not sure what it should be outputting here. I'm sure you do!)

Below is the console.log output followed by the thrown error again.


/Users/danieldafoe/Desktop/folder/app/jade/commonMixins.jade
/Users/danieldafoe/Desktop/folder/app/jade/config.jade
/Users/danieldafoe/Desktop/folder/app/jade/includes/error_Message.jade
/Users/danieldafoe/Desktop/folder/app/jade/includes/footer.jade
/Users/danieldafoe/Desktop/folder/app/jade/includes/head.jade
/Users/danieldafoe/Desktop/folder/app/jade/includes/legal.jade
/Users/danieldafoe/Desktop/folder/app/jade/includes/scripts.jade
/Users/danieldafoe/Desktop/folder/app/jade/includes/warning_Message.jade
/Users/danieldafoe/Desktop/folder/app/jade/layout.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/acc.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/accAlt.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/accBodyError.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/accFinanceCode.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/accFormError.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/accMortgageOnly.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/accPageErrorApproval.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/accPageErrorConfirmation.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/accPageErrorCritical.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/accPageErrorDefault.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/accPageErrorInstructional.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/accPageErrorNeedToKnow.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/accPageErrorPending.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/accPageErrorWarning.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/accSummary/accBanner.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/accSummary/accBody.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/accSummary/rewards.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/ccad.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/ccad/ccadBody.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/ccad/widget.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/ccadActivateNow.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/ccadBodyError.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/ccadCashBack.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/ccadFormError.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/ccadLimitedAuthorizedUser.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/ccadNoRewards.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/ccadPageErrorCritical.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/ccadUnlimitedAuthorizedUser.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/common/header.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/common/mainBody.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/common/notices.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/common/productBanner.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/common/productContent.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/common/promo.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/common/sidebar.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/common/topTools.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/mrc.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/mrc/homelineBody.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/mrc/mrcBody.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/mrcHomeline.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/pda.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/pda/pdaBody.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/pda/widget.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/pda2Products.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/pdaApplyOverdraft.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/pdaBodyError.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/pdaFormError.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/pdaNoOverdraft.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/pdaPageErrorCritical.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/pdaRewards.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/sidebarWidgets/generic.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/sidebarWidgets/myServices.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/sidebarWidgets/needAssistance.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/sidebarWidgets/promo.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/sidebarWidgets/quickPayment.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/signin.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/signin/b_olbLinks.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/signin/b_signinGeneric.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/signin/content.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/signin/header.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/signin/inputGroup.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/signin/inputOption.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/signin/mainNav.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/signin/signinPromo.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/signin/signin_inputcc.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/signin/signin_selectcc.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/signin/w_signinSec.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/signinError.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/signinMaintenance.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/signinOlb2Cols.jade
/Users/danieldafoe/Desktop/folder/app/jade/templates/signin_post.jade
/Users/danieldafoe/Desktop/folder/node_modules/browser-sync/node_modules/bs-recipes/recipes/gulp.jade
stream.js:74
      throw er; // Unhandled stream error in pipe.
      ^
Error: EISDIR: illegal operation on a directory, read
    at Error (native)
    at Object.fs.readSync (fs.js:603:19)
    at Object.fs.readSync (/Users/danieldafoe/Desktop/folder/node_modules/gulp-cssmin/node_modules/graceful-fs/polyfills.js:218:23)
    at Object.fs.readFileSync (fs.js:438:24)
    at _fn (/Users/danieldafoe/Desktop/folder/node_modules/jade-inheritance/lib/parser.js:53:50)
    at Parser.getInheritance (/Users/danieldafoe/Desktop/folder/node_modules/jade-inheritance/lib/parser.js:101:9)
    at _fn (/Users/danieldafoe/Desktop/folder/node_modules/jade-inheritance/lib/parser.js:82:71)
    at Parser.getInheritance (/Users/danieldafoe/Desktop/folder/node_modules/jade-inheritance/lib/parser.js:101:9)
    at new Parser (/Users/danieldafoe/Desktop/folder/node_modules/jade-inheritance/lib/parser.js:24:24)
    at new JadeInheritance (/Users/danieldafoe/Desktop/folder/node_modules/jade-inheritance/lib/index.js:10:16)
    at /Users/danieldafoe/Desktop/folder/node_modules/gulp-jade-inheritance/index.js:34:33
    at arrayEach (/Users/danieldafoe/Desktop/folder/node_modules/gulp-jade-inheritance/node_modules/lodash/index.js:1289:13)
    at Function.<anonymous> (/Users/danieldafoe/Desktop/folder/node_modules/gulp-jade-inheritance/node_modules/lodash/index.js:3345:13)
    at Stream.endStream (/Users/danieldafoe/Desktop/folder/node_modules/gulp-jade-inheritance/index.js:32:9)
    at _end (/Users/danieldafoe/Desktop/folder/node_modules/gulp-jade-inheritance/node_modules/event-stream/node_modules/through/index.js:65:9)
    at Stream.stream.end (/Users/danieldafoe/Desktop/folder/node_modules/gulp-jade-inheritance/node_modules/event-stream/node_modules/through/index.js:74:5)
juanfran commented 8 years ago

ok... I see the error, you have written baseDir instead of basedir ;)

danieldafoe commented 8 years ago

@juanfran Wow! Thank you so much. Although your disregard for camel case near killed me, I greatly appreciate the help.