Search code examples
gulpsitecorehelix

Task 'details' is not in your gulpfile


Trying to install gulp. But when check using gulp details command, then getting error like Task 'details' is not in your gulpfile. Is anybody face similar issue.


Solution

  • It is looking for task "details" in your gulpfile.js. You can run gulp --tasks to see what tasks are available, but you are for sure not going to see "details".

    Here's how to create and define gulp task

    So basically, you at least need something similar to the following snippet within your gulpfile.js

    function details(callback) {
      callback();
    }
    
    exports.details = details;
    

    Or, if using require-dir for better folder structure, you would need the previous code snippet within the referenced file :

    require('require-dir')('./gulp/tasks/details');
    

    And when using npm to run your task, like npm run details

    You can find those scripts definition in your package.json file at your project root. There is a node scripts where you can define npm script, where you could be calling the gulp details task

    ...
        "scripts": {
                     "details": "gulp details",
                  },
    ...
    

    You could run npm run details, and it would behind the scene run the gulp task.