admin管理员组文章数量:1332352
I'm following this tutorial on how to start with gulp and browserify (amongst other plugins).
The structure as follows:
.
├── gulpfile.js
└── gulp
├── index.js
└── tasks
├── browserify.js
└── minifyCss.js
/* gulpfile.js */
var gulp = require('./gulp')([
'minifyCss',
'browserify'
]);
gulp.task('default', ['minifyCss', 'browserify']);
/* index.js */
var gulp = require('gulp');
module.exports = function(tasks) {
tasks.forEach(function(name) {
gulp.task(name, require('./tasks/' + name));
});
return gulp;
};
/* tasks/minifyCss.js */
var gulp = require('gulp');
var minifyCss = require('gulp-minify-css');
gulp.task('minifyCss', function() {
return gulp.src('css/*.css')
.pipe(minifyCss())
.pipe(gulp.dest('dist'));
})
However, when running $ gulp
it produces the following error:
Error: Task minifyCss can't support dependencies that is not an array of strings
at Gulp.Orchestrator.add (/home/joao/src/joaopw/node_modules/gulp/node_modules/orchestrator/index.js:47:10)
at /home/joao/src/joaopw/gulp/index.js:5:14
at Array.forEach (native)
at module.exports (/home/joao/src/joaopw/gulp/index.js:4:11)
at Object.<anonymous> (/home/joao/src/joaopw/gulpfile.js:1:91)
at Module._pile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
I can't seem to find what's the problem here, am I missing some arguments or? The code is not so different from the example on the tutorial.
I'm following this tutorial on how to start with gulp and browserify (amongst other plugins).
The structure as follows:
.
├── gulpfile.js
└── gulp
├── index.js
└── tasks
├── browserify.js
└── minifyCss.js
/* gulpfile.js */
var gulp = require('./gulp')([
'minifyCss',
'browserify'
]);
gulp.task('default', ['minifyCss', 'browserify']);
/* index.js */
var gulp = require('gulp');
module.exports = function(tasks) {
tasks.forEach(function(name) {
gulp.task(name, require('./tasks/' + name));
});
return gulp;
};
/* tasks/minifyCss.js */
var gulp = require('gulp');
var minifyCss = require('gulp-minify-css');
gulp.task('minifyCss', function() {
return gulp.src('css/*.css')
.pipe(minifyCss())
.pipe(gulp.dest('dist'));
})
However, when running $ gulp
it produces the following error:
Error: Task minifyCss can't support dependencies that is not an array of strings
at Gulp.Orchestrator.add (/home/joao/src/joaopw/node_modules/gulp/node_modules/orchestrator/index.js:47:10)
at /home/joao/src/joaopw/gulp/index.js:5:14
at Array.forEach (native)
at module.exports (/home/joao/src/joaopw/gulp/index.js:4:11)
at Object.<anonymous> (/home/joao/src/joaopw/gulpfile.js:1:91)
at Module._pile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
I can't seem to find what's the problem here, am I missing some arguments or? The code is not so different from the example on the tutorial.
Share Improve this question asked Sep 3, 2015 at 19:49 João GonçalvesJoão Gonçalves 4,0032 gold badges23 silver badges36 bronze badges 2-
1
Since gulp
3.9
, this error can also occur when you're declaring a gulp task in ES6 arrow function style and you've not renamed your.gulpfile
named.gulpfile.babel.js
for transpiling – Dr1Ku Commented Jun 26, 2017 at 11:56 -
This can also occur when you're forgetting to wrap your extracted task into another closure (
function
) – Dr1Ku Commented Jun 26, 2017 at 12:04
1 Answer
Reset to default 6In your index.js
file inside the forEach
loop every gulp task must have a callback function, so you'll need to export one from your tasks like so:
/* tasks/minifyCss.js */
var gulp = require('gulp');
var minifyCss = require('gulp-minify-css');
module.exports = function() {
return gulp.src('css/*.css')
.pipe(minifyCss())
.pipe(gulp.dest('dist'));
};
本文标签: javascriptError Task x can39t support dependencies that is not an array of stringsStack Overflow
版权声明:本文标题:javascript - Error: Task x can't support dependencies that is not an array of strings - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742322842a2453136.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论