Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMartin Coutts
18,154 PointsGulp not working
Wondering if anyone else has dealt with this issue, I'm trying to used gulp in my project, at the moment there is just a simple task to copyHtml over from the src folder to the dist folder but I am getting this error
[15:48:25] Using gulpfile ~/Documents/Web Dev Projects/agasBakery/gulpfile.js
/usr/local/lib/node_modules/gulp/bin/gulp.js:129
gulpInst.start.apply(gulpInst, toRun);
^
TypeError: Cannot read property 'apply' of undefined
at /usr/local/lib/node_modules/gulp/bin/gulp.js:129:20
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
at Function.Module.runMain (module.js:695:11)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3
the file the error is pointing to says error on line 129 but it's a bin file with only this in it
#!/usr/bin/env node
require('gulp-cli')();
3 Answers
lauralouise
14,853 PointsGulp 4 (i.e. gulp-cli) uses a VERY different syntax than older gulp files. Gulp-CLI is NOT backwards compatible and contains breaking changes. You can install gulp CLI globally and still install gulp 3 locally in your folder to use the older version.
Martin Coutts
18,154 PointsThis was a massive oversight on my part, installed gulp version 3.9.1 globally and it worked perfectly. I'll need to get on to youtube and educate myself on the new syntax in version 4. Thank you.
Martin Coutts
18,154 Pointsgulp -v [07:18:51] CLI version 3.9.1 [07:18:51] Local version 4.0.0
From what I read online the issue was the cli not being the same as gulp however I tried updating the packages and npm said they were all up to date
lauralouise
14,853 PointsFWIW -- if you're going to be working with frameworks like React or Vue going forward, you might want to skip learning Gulp 4 syntax and instead devote your time to learning WebPack, which in my experience is much more widely used in React/Vue development. since Gulp 4 is still so new, Gulp 3 is still used widely, especially since every member of a development team needs to be running the same version of Gulp. For your own projects, if you don't want to get into WebPack (it's a lot to learn) you can stick with Gulp 3 if you like. Also using Create-React-App has Webpack config baked in, so if you're doing any React stuff you can just use that and not even bother with setting up your own build tool.
David Perkins
9,607 PointsDavid Perkins
9,607 PointsIn your Terminal run...
gulp -v
... and paste here what you get back so that i can try and diagnose the issue for you 👍🏻