Unable to find gulp task default when requiring a module that defines default gulp task
See original GitHub issueI am trying to require a gulpfile (someGulpfile.js) in my own gulpfile (gulpfile.js) from where I run the gulp command. When I try to use the tasks defined in someGulpfile it throws an error on console saying Task 'default' is not in your gulpfile
even though I just did require('./someGulpfile');
in my gulpfile.js
I found out that this somewhat works but it does not output every task that is run (for example it does not output, Starting sometask, Finished sometask, Starting default, …) and if there is an error it does not show the error and where it happened but errors out in the gulp library code where it has trouble formatting the error output.
//gulpfile.js
var gulp = require('gulp');
gulp.tasks = require('./someGulpfile').tasks;
//someGulpfile.js
var gulp = require('gulp');
gulp.task('sometask', function() {});
gulp.task('default', ['sometask']);
module.exports = gulp;
I am using version 3.8.11
Issue Analytics
- State:
- Created 8 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
When I run gulp in my project it gives me this error "can't find ...
If you've previously installed gulp globally, run npm rm --global gulp before following these instructions. Install the gulp command. npm ...
Read more >gulp-typescript - npm
To invoke, simple run gulp . var gulp = require('gulp');. var ts = require('gulp-typescript');. gulp.task('default', function () {.
Read more >gulp@1 - gulp v1 task | Microsoft Learn
Run the gulp Node.js streaming task-based build system. ... If this input isn't specified, the default task will run. targets - Gulp Task(s)...
Read more >How to Migrate to Gulp.js 4.0 - SitePoint
Set exports.default to define a default task run when gulp is executed from the command line without a specific task. Gulp Goodness.
Read more >Gulp Wiki | Barbarian Meets Coding
gulp.task lets you define arbitrary tasks for gulp to perform. ... By default everything before the glob starts but you can redefine it...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ankurp It sounds like your package and the other package are using different instances. I ran into a similar situation recently. Maybe there’s a better solution, but what I did was like this:
Hi. This work in my case. I was facing the “gulp task is not in your gulpfile” error message, when using “gulp-require-tasks” passing the gulp Instance solve the problem :
Many thanks for your post !