运行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 ...
随机推荐
- Leetcode: Pow(x, n) and Summary: 负数补码总结
Implement pow(x, n). Analysis: Time Complexity: O(LogN) Iterative code: refer to https://discuss.le ...
- 209. Minimum Size Subarray Sum(双指针)
Given an array of n positive integers and a positive integer s, find the minimal length of a contigu ...
- apache源码安装
1.apr和apr-util,下载地址: http://apr.apache.org/download.cgi yum install gcc yum install libtool yum inst ...
- animation-play-state
animation-play-state: css: .play-state{ -webkit-animation:f1 2s 0.5s infinite linear forwards altern ...
- C/C++之类型强制转化
强制转化四种类型可能很多人都常常忽略就象我一样,但是有时还是比较有用的.不了解的建议看看,一些机制我也不是十分了解,只是将一些用法写出来让大家看看. ...
- Vue源码解析之nextTick
Vue源码解析之nextTick 前言 nextTick是Vue的一个核心功能,在Vue内部实现中也经常用到nextTick.但是,很多新手不理解nextTick的原理,甚至不清楚nextTick的作 ...
- 热心网友设计出更美的Windows 10开始菜单
开始菜单应该算是Windows操作系统的标志之一,Win8时微软曾做了大刀阔斧的改革,没想到招致一片负面评价,最终紧急推出了Win8.1系统. Win10推出后,微软等于整合了磁贴和传统风格,但也做不 ...
- 2018 Java线程热门面试题,你知道多少?
面试,难还是不难?取决于面试者的底蕴(气场+技能).心态和认知及沟通技巧.面试其实可以理解为一场聊天和谈判,在这过程中有心理.思想上的碰撞和博弈.其实你只需要搞清楚一个逻辑:“面试官为什么会这样问?他 ...
- OpenCV-跟我一起学数字图像处理之拉普拉斯算子
https://www.cnblogs.com/german-iris/p/4840647.html Laplace算子和Sobel算子一样,属于空间锐化滤波操作.起本质与前面的Spatial Fil ...
- Python3: Windows系统上同时安装Python2和Python3
Python3: Windows系统上同时安装Python2和Python3 为什么要同时安装Python2和Python3环境呢? 因为一些库只支持Python2或者Python3; 在同一台电脑上 ...