Problem to use Gulp

Asked

Viewed 633 times

3

Look at this, I’m starting to use the Gulp 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, he says he did not find the gulpfile, although he is present. If I rename gulpfile.js to Gulpfile.js the error changes, the following appears:

/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 Ode, Ulp and everything, but nothing’s working. Node is in version 0.10.25 NPM is in version 1.3.24

  • I think it would help to include in the question: 1) The directory structure and the name of all the files involved; 2) Which command you are using to invoke Gulp and 3) The contents of your Gulpfile.

  • I managed to solve the problem. The nodejs in the Elementary OS repository (based on Ubuntu 12.04) is an older version, not compatible with Gulp. Hence I had upgraded Node, using the official PPA and despite this, there were settings of the old version on the system still, even using purge. Hence I removed the Node folders that I found and reinstalled, now Gulp works.

  • Luis Henrique: You can post this as an answer and accept after 24 hours. So you help if someone appears later as the same problem.

  • Thanks for the tip, @missingno. I did that.

3 answers

1


I managed to solve the problem. The nodejs in the Elementary OS repository (based on Ubuntu 12.04) is an older version, not compatible with Gulp. Hence I had upgraded Node, using the official PPA and despite this, there were settings of the old version on the system still, even using purge. Hence I removed the Node folders that I found and reinstalled, now Gulp works.

0

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

gulp.task('default', function() {
    gulp.run('scripts', 'styles', 'images', 'lr-server');
});

-1

Missing set a task with default name.

gulp.task('default', function() {
   /* cód aqui */
});
  • No, it didn’t. The problem was that I wasn’t using the correct version of Ode, as pointed out in the answer.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.