LightBen LightBen - 1 year ago 95
Node.js Question

Gulp doesn't work and returns nothing, just opens the gulp.js file

I wanted to begin to use Gulp for the common simple tasks like SCSS compiling. But once I ran Gulp, it simply opened the file gulp.js.

After many searches and tries, I reduced all to the minimum possible:
I uninstalled NodeJS, rebooted, and reinstalled it. Then I reinstalled Gulp globally. Then I created a folder test with inside a index.html, and a folder scss with inside my style.scss. I did cd myfolder in the console and installed Gulp inside (npm init then npm install gulp --save-dev). I also created the simplest gulp.js file:

var gulp = require('gulp');

gulp.task('default', function() {

When I write "gulp" in the console, it does the same: it opens the gulp.js file without doing anything. It doesn't return any value either.

Does someone know about this behavior?

Thanks =)

Answer Source

Please rename the file to gulpfile.js

(I deleted the answer because I wasn't sure about your filename)

By naming the task as default, it will run as you call "gulp" command. For other names, you can call the tasks by name such as:

gulp check-style


gulp.task('check-style', function(){
    // your code
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download