运行gulp提示:Task function must be specified
问题出在gulp版本上,以下是gulp3 VS gulp4的区别:
gulp4最大的变化是不能像以前那样传递一个依赖的任务列表。
gulp3中,如果有一个任务A、B和C的列表,你想在一个序列中运行(确保A在B开始之前完成,而B在C开始之前完成),代码如下:
gulp.task('a',() => {
// Do something
}); gulp.task('b',['a'],() => {
// Do something
}); gulp.task('c',['b'],() => {
// Do something
});
在gulp4中,不能再这样做了。会得到以下错误:
$ gulp c
assert.js:350
throw err;
^ AssertionError [ERR_ASSERTION]: Task function must be specified
at Gulp.set [as _setTask] (C:\Users\zxq\Desktop\gulpCourse\node_modules\_undertaker@1.2.0@undertaker\lib\set-task.js:10:3)
at Gulp.task (C:\Users\zxq\Desktop\gulpCourse\node_modules\_undertaker@1.2.0@undertaker\lib\task.js:13:8)
at Object.<anonymous> (C:\Users\zxq\Desktop\gulpCourse\gulpfile.js:17:6)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
不要再用gulp 3的方式指定依赖任务,你需要使用gulp.series和gulp.parallel,因为gulp任务现在只有两个参数。
gulp.series:按照顺序执行
gulp.parallel:可以并行计算
gulp.task('my-task',gulp.series('a','b','c',() => {
// Do something after a,b, and c are finished.
})); gulp.task('build',gulp.parallel('style','script','images',() => {
// build the website.
}));
或者这样
gulp.task('my-task',gulp.series('a',gulp.parallel('style','script','image'),'b','c',() => {
// Do something after a, b, and c are finished.
}));
相关任务必须在被调用之前发生。
运行gulp提示:Task function must be specified的更多相关文章
- 运行gulp项目报错:AssertionError: Task function must be specified。
一.问题描述: gulp项目在本地windows 10机器上跑没有任何问题,但是放在centos 7虚拟机上跑报错:AssertionError: Task function must be spec ...
- gulp报错task function must be specified
1.我npm安装了Browserify,tsify和vinyl-source-stream包,想要引用安装的插件,所以就走了引用插件的流程,修改了gulpfiles.js文件,引用流程完毕后,在终端g ...
- AssertionError [ERR_ASSERTION]: Task function must be specified,gulp版本不一致
报错信息: vue项目打包报错 > innovate-admin-vue@ build /home/soldier/SOLDIER/IDE_project/webStorm_project/in ...
- 运行js提示库没有注册错误8002801d的解决办法
运行js提示库没有注册错误8002801d的解决办法这个错误主要是因为服务器上的windows scripts版本较低,请按下面的链接下载较高版本windows scripts 5.6并在服务器上进行 ...
- win7以管理员身份运行bat提示系统找不到指定的路径。
windows7“以管理员身份运行”bat提示“系统找不到指定的路径.” 使用批处理安装服务,直接双击运行没有权限,右键“以管理员身份运行”却提示“系统找不到指定的路径.”,反复查看路径是正确的. 打 ...
- 解决IIS7运行ASP提示错误:An error occurred on the server when processing the URL. Please contact the system administrator
原文:解决IIS7运行ASP提示错误:An error occurred on the server when processing the URL. Please contact the syste ...
- 【已解决】【Mac】 运行adb提示command not found,需要配置adb环境
问题:运行adb提示command not found 解决措施: 1.下载安装:android-sdk-macosx 下载路径:http://down.tech.sina.com.cn/page/ ...
- Windows10家庭版运行应用提示”管理员已阻止你运行此应用...“的解决办法
win10版本家庭中文版: 运行应用程序报错: 解决办法(亲试): 1.进入”控制面板“--”用户账户“--”用户账户“,选择”更改用户账户控制设置“,选择最后一项,点击”确定“按钮,如下图: 2.按 ...
- 【python】python打包生成的exe文件运行时提示缺少模块
事情是这样的我用打包命令:pyinstaller -F E:\python\clpicdownload\mypython.py打包了一个exe程序,但是运行时提示我缺 少bs4模块然后我就去查pyin ...
随机推荐
- 3:3 OGNL 表达式一
一: 用例 (直接链式访问属性名,其实内部还是的调用set,get方法实现数据的流动); 二: 注意:表达式里面是没有方法的,只能点属性, 访问列表: (访问的时候加上#,表示访问非值栈的内容.) 访 ...
- marquee实现跑马灯
<!DOCTYPE html><html> <head><title>跑马灯大全</title> </head> <bod ...
- EntityFramework包含作用
System.Data.Entity.Infrastructure.DbQuery的引用需要加入上面那个包
- 关于Spring中,定时任务执行两次的解决办法
原因:如果spring-quartz.xml文件,在Spring的配置文件spring-config.xml中被加载,那么定时任务会被Spring和SpringMVC扫描两次,所以会被执行两次. 解决 ...
- Redis设置密码重启后失效的解决方案
原因可能有两个: 1.只是单纯的通过命令行设置了密码,这种设置方式是临时的,当服务器重启后,密码会失效. config set requirepass yourPassword 解决方案:在redis ...
- https的设置
现有如下的web架构(简化之后的),需要把原来的http访问修改到https访问! haproxy的认证有两种方式: 第一种:haproxy提供ssl证书,后面的nginx访问使用正常的http. 第 ...
- python中hasattr, getattr,setattr及delattr四个方法
通过一个实例来说明,这四个函数的用法: 首先一个如下的一个简单的类: class Animal(object): def __init__(self,name, zone): self.name = ...
- Jquery 数组与字符串之间的转换
var auth_list = []; $("input[name='auth_list']:checkbox").each(function () { if ($(this).a ...
- Executor简析
本文只做简要解析,实际情形下我们多用spring的taskExecutor 直接使用new Thread()创建线程的缺点: 1.new Thread()耗费性能 2.调用new Thread()创建 ...
- 思考卷积神经网络(CNN)中各种意义
原文:https://blog.csdn.net/aimreant/article/details/53145063 思考卷积神经网络(CNN)中各种意义 只是知道CNN是不够,我们需要对其进行解剖, ...