0

Hi There

I'm working on a project which I'm using Gulp . All was Okay before i used Autoprefixer Plugin and Watch Command . Now when I run gulp at the terminal. My windows 10 is off without any Error message .

gulpfile.js code

var gulp = require("gulp"),
    image_minify = require("gulp-image"),
    plumber = require("gulp-plumber"),
    autoprefixer = require("gulp-autoprefixer");

/* Image Minify */
gulp.task("imageMinify", function() {
    gulp.src("assets/images/**/*")
        .pipe(plumber())
        .pipe(image_minify())
        .pipe(gulp.dest("assets/images/mini"));
});

/* Css Autoprefixer */
gulp.task("prefix", function() {
    gulp.src("assets/css/*.css")
        .pipe(plumber())
        .pipe(autoprefixer({ browsers: ["last 10 versions"] }))
        .pipe(gulp.dest("assets/style.css"));
});

/* Watch Function (watch the src and make action) */
gulp.task("watch", function() {
    gulp.watch("assets/images/**/*", ["imageMinify"]);
    gulp.watch("assets/css/*.css", ["prefix"]);

}); 
/* Default Function */
gulp.task("default", ["watch", "imageMinify", "prefix"]);

Package.json Code

  "devDependencies": {
    "gulp-autoprefixer": "^4.0.0",
    "gulp-image": "^3.0.0",
    "gulp-imagemin": "~3.3.0",
    "gulp-plumber": "^1.1.0"
  }

Any Help Please ?

Thanks In Advance

Akinjide
  • 2,723
  • 22
  • 28
Norhan
  • 105
  • 2
  • 16
  • are you saying... windows 10 shuts down when you run gulp? – Kevin B Sep 06 '17 at 19:28
  • @KevinB yes ... without any error or warning – Norhan Sep 06 '17 at 19:30
  • Do you get any error or message when windows 10 comes back on? – Akinjide Sep 06 '17 at 19:44
  • @akinjide No :( .... Nothing – Norhan Sep 06 '17 at 19:47
  • it shuts down suddenly and it works normally when i run it again .. Then when i run gulp watch it shuts down suddenly again !!! – Norhan Sep 06 '17 at 19:52
  • What version of Node and Gulp do you have installed? – Akinjide Sep 06 '17 at 19:53
  • What is " mini project " ?do you mean minify the project files ? i'm just beginner at gulp :) – Norhan Sep 06 '17 at 19:54
  • Gulp :3.9.1 and Node : v6.11.2 – Norhan Sep 06 '17 at 19:55
  • to me this sounds like a problem unrelated to gulp, but i'm not sure what to suggest to try to narrow down what causes it. Try monitoring your hardware usage/temps before and during. – Kevin B Sep 06 '17 at 20:05
  • Adding to what kelvin said you can also create another mini project with Gulp and here's a sample gulpfile doing exactly what you're doing but in es6 >> https://github.com/akinjide/akinjide-photography/blob/master/gulpfile.js – Akinjide Sep 06 '17 at 21:02
  • @KevinB i thought that but i checked before it shuts down and it was normal ( CPU :12% , Memory: 86% , Disk : 58%) .Did it relate to the Memory ? – Norhan Sep 06 '17 at 21:09
  • @akinjide Thanks will do that ,, hope this fix the problem – Norhan Sep 06 '17 at 21:10
  • doubt it. but there's very few things that can cause an OS to flat out shut down unexpectedly, overheating being one of them – Kevin B Sep 06 '17 at 21:10
  • @KevinB For overheating,Yes i doubted it also and i watched .Once i run the window and first thing is run "gulp watch" .. it shuts down . – Norhan Sep 06 '17 at 21:18

1 Answers1

0

The problem was a performance issue

My windows was V 10 and Ram was 4

The solution that worked for me was exchange the window version from 10 to 7 ultimate and it works well

Another good solution that change Ram with 8 or higher
But I preferred the first one as I wasn't comfortable with windows 10 performance :)

NightOwl888
  • 55,572
  • 24
  • 139
  • 212
Norhan
  • 105
  • 2
  • 16