TypeError: listener must be a function
See original GitHub issueRecently my gulp task to build styles has started to fail with a very cryptic error message and I can’t seem to find any fix. This ran fine before, I can’t really say what has changed since then. I do however always seem to have to reinstall gulp-sass to get it to stop complaining about lib-sass bindings. My task looks like this:
gulp.task('sass', function() {
gulp.src('./assets/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./dev'));
});
And the error I’m getting:
[14:52:06] TypeError: listener must be a function
at TypeError (native)
at Stream.addListener (events.js:142:11)
at Gulp.<anonymous> (/Applications/MAMP/htdocs/<REDACTED>/<REDACTED>/gulpfile.js:38:18)
at module.exports (/Applications/MAMP/htdocs/<REDACTED>/<REDACTED>/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7)
at Gulp.Orchestrator._runTask (/Applications/MAMP/htdocs/<REDACTED>/<REDACTED>/node_modules/gulp/node_modules/orchestrator/index.js:273:3)
at Gulp.Orchestrator._runStep (/Applications/MAMP/htdocs/<REDACTED>/<REDACTED>/node_modules/gulp/node_modules/orchestrator/index.js:214:10)
at Gulp.Orchestrator.start (/Applications/MAMP/htdocs/<REDACTED>/<REDACTED>/node_modules/gulp/node_modules/orchestrator/index.js:134:8)
at /Users/ianaw/.nvm/versions/node/v0.12.7/lib/node_modules/gulp/bin/gulp.js:129:20
at process._tickCallback (node.js:355:11)
at Function.Module.runMain (module.js:503:11)
Issue Analytics
- State:
- Created 8 years ago
- Comments:14
Top Results From Across the Web
TypeError: listener must be a function - Stack Overflow
removeListener takes two arguments and the function is supposed to be the second argument, so you are passing the function as the name...
Read more >TypeError: The listener must be a function index.js:60 - Phaser 3
As the title says, is there anything i can fix?, i really dont wanna touch the framework index files. that feels scary.
Read more >http.request TypeError: "listener" argument must be a function
After switching to use the request library, I have no issue. Seems to be an underlying issue with the http module.
Read more >listener must be a function' after editing an error message ...
I get a message: 'events.js:210 throw new TypeError('listener must be a function');' , although it prints out this custom error message ...
Read more >The "listener" argument must be of type function. Received ...
TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received undefined ... console.log ('JorisAndCoStudiosBot is ...
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 Free
Top 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
Just remove “.on(‘error’, sass.logError)” and it will be fine.
@gaomeng1900 and how would you log the errors then?