当我尝试运行gulp时,我得到标题错误。
我的gulpfile.js:
var gulp = require('gulp'),
connect = require('gulp-connect-php'),
gulpPhpunit = require('gulp-phpunit');
gulp.task('gulpPhpunit', function() {
var options = {debug: false};
gulp.src('phpunit.xml')
.pipe(phpunit('./vendor/bin/phpunit',options));
});
gulp.task("default", ["gulpPhpunit"]);错误
// error
assert.js:42
throw new errors.AssertionError({
^
AssertionError [ERR_ASSERTION]: Task function must be specified
at Gulp.set [as _setTask] (/var/www/html/wptest2/node_modules/undertaker/lib/set-task.js:10:3)
at Gulp.task (/var/www/html/wptest2/node_modules/undertaker/lib/task.js:13:8)
at Object.<anonymous> (/var/www/html/wptest2/gulpfile.js:26:6)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)“必须指定任务函数”,我是不是没有正确地指向gulpPhpunit?代码是从文档中复制出来的(示例2)。
发布于 2019-03-21 21:59:31
如果您使用gulp v4,则语法已更改。您可以降级您的gulp版本,或者更改代码的某些部分以使用新的gulp版本运行:
var gulp = require('gulp'),
connect = require('gulp-connect-php'),
gulpPhpunit = require('gulp-phpunit');
gulp.task('gulpPhpunit', function (done) {
// var options = {debug: false};
gulp.src('phpunit.xml')
.pipe(phpunit('./vendor/bin/phpunit', options));
done();
});
gulp.task("default", gulp.series('gulpPhpunit'));更改是done回调和gulp.series()部件。
https://stackoverflow.com/questions/55281749
复制相似问题