Gulp command opens gulp.js in notepad instead of running it

雨燕双飞 提交于 2019-12-08 16:17:04

问题


I installed it correctly I think.

My package.json

   {
      "name": "my-project",
      "version": "0.1.0",
      "devDependencies": {
        "gulp": "^3.8.11",
        "gulp-concat": "^2.5.2"
      }
    }

my gulp.js

var gulp = require('gulp');

    var concat = require('gulp-concat');

    gulp.task('scripts', function() {
        return gulp.src('js/*.js')
          .pipe(concat('main.js'))
          .pipe(gulp.dest('build/js'));
    });

    gulp.task('default', ['scripts']);

my folder are as follow :

ROOT/package.json
ROOT/gulp.js
ROOT/node-modules/   <-- my modules are here
ROOT/js/  <-- my js are here

When I run gulp in command line, being in the ROOT folder, gulp.js just opens in windows notepad and that's all..

Why is it doing that?


回答1:


problem solved by a simple action: renaming gulp.js to gulpfile.js (sigh..)




回答2:


Two steps: Step-1) renaming gulp.js to gulpfile.js as exposed in answer above; Step-2) using npm install -g gulp-cli



来源:https://stackoverflow.com/questions/30128092/gulp-command-opens-gulp-js-in-notepad-instead-of-running-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!