furzeface / gulp-cache-bust

⚠️ not maintained
35 stars 21 forks source link

TypeError #2

Closed kseagrav closed 8 years ago

kseagrav commented 9 years ago

If I try to use this, I get the error:

TypeError: Object # has no method 'on' at Transform.Readable.pipe (/home/kseagraves/trunk/app/WebView/node_modules/gulp-usemin/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:516:8) at Gulp.gulp.task.gulp.src.base (/home/kseagraves/trunk/app/WebView/gulpfile.js:130:10) at module.exports (/home/kseagraves/trunk/app/WebView/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7) at Gulp.Orchestrator._runTask (/home/kseagraves/trunk/app/WebView/node_modules/gulp/node_modules/orchestrator/index.js:273:3) at Gulp.Orchestrator._runStep (/home/kseagraves/trunk/app/WebView/node_modules/gulp/node_modules/orchestrator/index.js:214:10) at /home/kseagraves/trunk/app/WebView/node_modules/gulp/node_modules/orchestrator/index.js:279:18 at finish (/home/kseagraves/trunk/app/WebView/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:21:8) at module.exports (/home/kseagraves/trunk/app/WebView/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:60:3) at Gulp.Orchestrator._runTask (/home/kseagraves/trunk/app/WebView/node_modules/gulp/node_modules/orchestrator/index.js:273:3) at Gulp.Orchestrator._runStep (/home/kseagraves/trunk/app/WebView/node_modules/gulp/node_modules/orchestrator/index.js:214:10)

My implementing code looks like: gulp.src(html_files) .pipe(usemin({ css: [minifyCSS(css_minifier_options), 'concat'], html: [minifyHTML(html_minifier_options)], js: [uglify(uglify_options)] })) .pipe(cachebust({ type: 'timestamp' })) .pipe(gulp.dest('./' + dir + '/'));

If I remove the lines about cachebust, I don't get any errors, so I believe this package is the source of the problem.

mcattx commented 9 years ago

@furzeface

I got a type error like this.

Users/cat/projects/gulp-test/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:516
  dest.on('unpipe', onunpipe);
       ^
TypeError: undefined is not a function
    at DestroyableTransform.Readable.pipe (/Users/cat/projects/gulp-test/node_modules/gulp/node_modules/vinyl-fs/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:516:8)
    at Object.<anonymous> (/Users/cat/projects/gulp-test/md5-test/gulpfile.js:11:4)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Liftoff.handleArguments (/usr/local/lib/node_modules/gulp/bin/gulp.js:116:3)
    at Liftoff.<anonymous> (/usr/local/lib/node_modules/gulp/node_modules/liftoff/index.js:181:16)

Furthermore, your example code on npm miss a ) in Usage part .

furzeface commented 9 years ago

@titancat - I've corrected the typo, thanks. Do you have a usage example from your gulpfile.js so I can see if it’s to do with this plugin? Thank you.

mcattx commented 9 years ago

@furzeface - Here is my usage example.Did I make some mistake?

var gulp = require('gulp'),
  cachebust = require('gulp-cachebust');

gulp.task('cachebust',function(){
  gulp.src('./dist/*/*.html')
    .pipe(cachebust({
      type: 'timestamp'
    }))
    .pipe(gulp.dest('./dist'));
})

gulp.task('default', function(){
  console.log('Default task start...');
  gulp.start('cachebust');
})
eranshapira commented 9 years ago

yup, we need to use require('gulp-cache-bust') and not the package in the example, there's a missing semicolon...