Problem to use gulp

3

Look, I'm starting to use the gulp I started a project on my work computer and everything worked correctly (Elementary OS).

Now at home the gulp does not work well (also Elementary OS). When I run the gulp command, it says it did not find the gulpfile, although it is present. If I rename gulpfile.js to Gulpfile.js the error changes, appearing as follows:

/usr/local/lib/node_modules/gulp/index.js:16
        throw new Error("No task named \"" + name + "\"");
              ^
Error: No task named "default"
    at /usr/local/lib/node_modules/gulp/index.js:16:15
    at Array.forEach (native)
    at Object.module.exports.gulp.run (/usr/local/lib/node_modules/gulp/index.js:13:11)
    at Object.<anonymous> (/usr/local/lib/node_modules/gulp/bin/gulp:17:8)
    at Module._compile (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 Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3

I've reinstalled the node, gulp, and everything, but nothing works. Node is in version 0.10.25 NPM is in version 1.3.24

    
asked by anonymous 13.02.2014 / 23:11

3 answers

1

I ended up solving the problem. The nodejs that is in the Elementary OS repository (based on Ubuntu 12.04) is an older version, not compatible with gulp. Hence I had upgraded the node, using the official PPA, and despite that, there were configurations of the old version in the system still, even using the purge. Then I removed the folders from the node I found and reinstalled, now gulp works.

    
16.02.2014 / 02:17
0

Make sure that in your gulpfile.js there is indeed a default task, as in the example below:

gulp.task('default', function() {
    gulp.run('scripts', 'styles', 'images', 'lr-server');
});
    
14.02.2014 / 11:18
-1

Failed to define a task with the default name.

gulp.task('default', function() {
   /* cód aqui */
});
    
28.02.2017 / 01:24