Fixit #1: When Gulp is giving you the Cannot read property ‘apply’ treatment?

Reading Time: 1

Fixit

Fixits are small posts that provide a straight forward answer for issues that occur during development.

When you’re working on Hybrid apps or Web apps with a tool belt including Grunt it is possible that Gulp is giving you the “TypeError: Cannot read property ‘apply’ of undefined” finger. I’ve experienced this when using a Yeoman generator and Grunt wouldn’t nudge.

Expected result
Grunt functioning like normal (building with grunt / grunt build.

Real outcome

TypeError: Cannot read property 'apply' of undefined
at C:\Users\ATUL KALE\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:129: 19

at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
at Module.runMain (module.js:577:11)
at run (bootstrap_node.js:352:7)
at startup (bootstrap_node.js:144:9)
at bootstrap_node.js:467:3

Fix

Reinstall gulp-cli did fix this for me:

npm install -g gulp-cli

Resources
I found this after Googling around: https://github.com/gulpjs/gulp-cli/issues/31. Although code version 4 – and using npm install -g “gulpjs/gulp-cli#4.0” – isn’t appropriate anymore it led me to try to re-install gulp-cli.