tptompkins's avatar

Any idea how I can fix this error? TypeError: gulp.hasTask is not a function

Hello,

I'm jumping back into an older Laravel 5.2 app that used to run gulp just fine but I went to run it today and it didn't work. I think I messed with my Node / NPM versions since I last ran it so I suspected this had something to do with it. I deleted my node_modules folder completely, downgraded my Node version to 6.4.0 then ran:

sudo npm install --global gulp-cli

Then I ran the following:

sudo npm install

After doing that I ran gulp and now I'm getting this error:

[20:07:55] Using gulpfile ~/eclipse-projects/ucpics/gulpfile.js
[20:07:55] Starting 'default'...
[20:07:55] 'default' errored after 2.25 ms
[20:07:55] TypeError: gulp.hasTask is not a function
    at /Users/tommytompkins/eclipse-projects/ucpics/node_modules/run-sequence/index.js:19:22
    at Array.forEach (native)
    at verifyTaskSets (/Users/tommytompkins/eclipse-projects/ucpics/node_modules/run-sequence/index.js:13:11)
    at runSequence (/Users/tommytompkins/eclipse-projects/ucpics/node_modules/run-sequence/index.js:92:2)
    at /Users/tommytompkins/eclipse-projects/ucpics/node_modules/laravel-elixir/tasks/default.js:18:16
    at taskWrapper (/Users/tommytompkins/eclipse-projects/ucpics/node_modules/undertaker/lib/set-task.js:13:15)
    at bound (domain.js:280:14)
    at runBound (domain.js:293:12)
    at asyncRunner (/Users/tommytompkins/eclipse-projects/ucpics/node_modules/async-done/index.js:55:18)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)

Anyone have any idea how I can fix this and still run gulp on Laravel 5.2? Thanks in advance!

Tommy

0 likes
2 replies
tptompkins's avatar

Hi Again -

I'm still trying to figure out why this is not working and I'm curious if there was any sort of well known reason why Laravel 5.2 / Elixir / Gulp would no longer work after so much time? I feel like there might be something simple about that setup that I'm just not aware of. I did notice that Elixir isn't even a thing anymore and has been replaced by something called Mix? Might this have something to do with it?

I don't want to go down the rabbit hole of upgrading from 5.2 to 5.5 quite yet. I just need to get my 5.2 install that used to work great on my machine working again. If anybody has any ideas or suggestions, I would greatly appreciate it.

Thanks much,

Tommy

tptompkins's avatar
tptompkins
OP
Best Answer
Level 7

For anyone that's wondering, I found that there was a breaking change that was introduced in Gulp version 4.0. To fix this, I did the following:

npm install --save-dev [email protected]

After that I deleted my node_modules folder ran a new 'npm install' and everything was working fine again. Hopefully that helps somebody else from pulling their hair out.

2 likes

Please or to participate in this conversation.