gulp assert.js:350 t-6ren">
gpt4 book ai didi

gulp - 运行 gulp 时出现 "Task function must be specified at Gulp.set"错误

转载 作者:行者123 更新时间:2023-12-05 08:53:22 24 4
gpt4 key购买 nike

我在安装gulp的时候总是出现同样的错误:

C:\Users\Thomas\Desktop\Sites CT Graphics\colpaertmarc.be>gulp
assert.js:350
throw err;
^

AssertionError [ERR_ASSERTION]: Task function must be specified at Gulp.set [as _setTask] (C:\Users\Thomas\Desktop\Sites CT Graphics\colpaertmarc.be\node_modules\undertaker\lib\set-task.js:10:3) at Gulp.task (C:\Users\Thomas\Desktop\Sites CT Graphics\colpaertmarc.be\node_modules\undertaker\lib\task.js:13:8) at Object. (C:\Users\Thomas\Desktop\Sites CT Graphics\colpaertmarc.be\gulpfile.js:19:6) at Module._compile (internal/modules/cjs/loader.js:689:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3) at Module.require (internal/modules/cjs/loader.js:637:17) at require (internal/modules/cjs/helpers.js:22:18)

最佳答案

将 gulp 版本从 3.* 升级到 4.* 后会出现此错误。如果你不想降级 gulp,那么你将不得不重写 gulp tasks 以对 v4 api 有效。下面是如何将简单的 gulp 任务从 v3 中使用的 api 表示法重写为与 v4 兼容的表示法的示例。

gulp v3

var gulp = require('gulp');

// Deleting resources task
gulp.task('clearResources', function() {
console.log('Deleting resources');
});

// Default gulp task
gulp.task('default', ['clearResources'], function() {
console.log('Running default task');
});

gulp v4

var gulp = require('gulp');

// Delete resources function
function clearResources() {
console.log('Deleting resources');
};

// Gulp task(s)
exports.clear = clearResources;
exports.default = gulp.series(clearResources);

关于gulp - 运行 gulp 时出现 "Task function must be specified at Gulp.set"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53881064/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com