TypeError: dest.on is not a function
See original GitHub issueI am having trouble using this module.
Script:
var path = require('path')
var gulp = require('gulp')
var imagemin = require('imagemin')
var merge2 = require('merge-stream');
var merge = require('merge2');
var gm = require('gulp-gm');
var spritesmith = require('gulp.spritesmith');
var spritesmash = require('gulp-spritesmash');
var pngquant = require('imagemin-pngquant');
var rename = require("gulp-rename");
var source = "./testorig/"
var dest = "./test/"
gulp.task('sprites', function () {
var files = gulp.src(source+'/*.png')
// Short version:
var spriteData = files
.pipe(spritesmith({
imgName: 'sprite.png',
cssName: 'sprite.css'
}));
var buffer = require('vinyl-buffer');
var imgStream = spriteData.img
.pipe(buffer())
.pipe(imagemin({
progressive: true,
interlaced: true,
optimizationLevel: 7,
svgoPlugins: [{
removeViewBox: false
}, {
removeUselessStrokeAndFill: false
}],
plugins: [
pngquant({
quality: [70,90],
speed: 1
})
]
}))
.pipe(gulp.dest(dest));
});
Trace:
[08:08:50] Starting 'sprites'...
[08:08:50] 'sprites' errored after 11 ms
[08:08:50] TypeError: dest.on is not a function
at DestroyableTransform.Readable.pipe (/srv/test/node_modules/readable-stream/lib/_stream_readable.js:564:8)
at /srv/test/gulpfile.js:64:10
at taskWrapper (/srv/test/node_modules/undertaker/lib/set-task.js:13:15)
at bound (domain.js:301:14)
at runBound (domain.js:314:12)
at asyncRunner (/srv/test/node_modules/async-done/index.js:55:18)
at _combinedTickCallback (internal/process/next_tick.js:132:7)
at process._tickCallback (internal/process/next_tick.js:181:9)
Versions:
Nodejs: 8.15.0
"dependencies": {
"gulp": "^4.0.0",
"gulp-gm": "^0.0.9",
"gulp-rename": "^1.4.0",
"gulp-spritesmash": "^1.1.1",
"gulp.spritesmith": "^6.9.0",
"imagemin": "^6.1.0",
"imagemin-pngquant": "^7.0.0",
"merge-stream": "^1.0.1",
"merge2": "^1.2.3",
"vinyl-buffer": "^1.0.1"
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
What does this mean: TypeError: dest.on is not a function
The error is happening in the pipe() method in readable-stream. dest is the name of the first argument to pipe() ; the fact...
Read more >usage demo comes error: "TypeError: dest.on is not a function ...
I run the usage demo: const yauzl = require("yauzl"); yauzl.open("./OMStarPS_npi.capacity_11.5.0.zip", {lazyEntries: true}, function(err, ...
Read more >[Solved]-TypeError: dest.on is not a function-node.js
You want fs.createWriteStream(). fs.openSync() just returns a file descriptor. So it would be: k.stderr.pipe(fs.createWriteStream('/dev/ ...
Read more >Node.js Stream Introduction. Some definition | by La Javaness IT
In those case, not storing everything in memory at once will be beneficial. ... TypeError: dest.write is not a function.
Read more >TypeError: dest.on is not a function - Tips &Tricks
Following is the anti pattern gulp.src( 'Foo' ).pipe( shell( 'Bar' ) ); Use the following pattern gulp.task( 'Foo', shell.task('Bar') ) ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah, I see the issue. You’re using
imagemin
instead ofgulp-imagemin
:For reference, we do provide the README examples in
docs/gulpfile.js
. I was able to verifygulp sprite-pipeline
is still working:https://github.com/twolfson/gulp.spritesmith/blob/6.9.0/docs/gulpfile.js#L23-L44
It sounds like the vinyl-buffer syntax has changed. Can you check their README for preferred usage?
This could be a different require due to an ES6 export or maybe they expect options now
Another way to resolve it might be jumping back in major versions for vinyl-buffer but it’s prob best to figure out what’s new with the latest
On Sat, Feb 16, 2019, 2:58 PM Jeremy <notifications@github.com wrote: