Reputation: 2007
I am trying to manipulate text before a file is sent to browserify, and I am attempting to use gulp.series to do this. Here's how:
gulp.task('dev_urls', function() {
gulp.src([ 'app/index.js' ])
.pipe(...)
.pipe(gulp.dest(...))
gulp.task('build_dev',
gulp.series('dev_urls', 'browserify', gulp.parallel('copy')))
When I execute the build_dev
task using gulp build_dev
from the command line, I am given this error:
/usr/local/lib/node_modules/gulp/bin/gulp.js:121
gulpInst.start.apply(gulpInst, toRun);
^
TypeError: Cannot read property 'apply' of undefined
at /usr/local/lib/node_modules/gulp/bin/gulp.js:121:19
at doNTCallback0 (node.js:407:9)
at process._tickDomainCallback (node.js:377:13)
at Function.Module.runMain (module.js:477:11)
at startup (node.js:117:18)
at node.js:951:3
How can I get this to work?
EDIT: I am getting that same error with this file:
var gulp = require('gulp');
gulp.task('build_dev', function() {
console.log(1);
})
Upvotes: 2
Views: 1855
Reputation: 6791
You need to return from your function.
gulp.task('dev_urls', function() {
return gulp.src([ 'app/index.js' ])
.pipe()
}
Also make sure that gulp is installed correctly.
$ sudo rm /usr/local/bin/gulp
$ sudo rm -rf /usr/local/lib/node_modules/gulp
$ npm uninstall gulp
$ npm install gulpjs/gulp-cli#4.0 -g
# install Gulp 4 into your project
$ npm install gulpjs/gulp.git#4.0 --save-dev
Upvotes: 2