A
A
Alex_22222016-04-11 19:19:43
gulp.js
Alex_2222, 2016-04-11 19:19:43

Problem with Gulp, how to fix?

Hello, gulp throws a segfault when I run it.

$ gulp
[19:04:46] Using gulpfile ~\Desktop\site\gulpfile.js
[19:04:46] Starting 'browser-sync'...
[19:04:46] Finished 'browser-sync' after 52 ms
[19:04:46] Starting 'sass'...
[19:04:46] Starting 'scripts'...
/c/Users/user/AppData/Roaming/npm/gulp:
 line 14:  2716 Segmentation fault 
     node "$basedir/node_modules/gulp/bin/gulp.js" "[email protected]"

вот сам gulpfile.js:

var gulp       = require('gulp'),
  sass         = require('gulp-sass'), 
  browserSync  = require('browser-sync'),
  concat       = require('gulp-concat'),
  uglify       = require('gulp-uglifyjs'),
  cssnano      = require('gulp-cssnano'),
  rename       = require('gulp-rename'),
  del          = require('del'),
  imagemin     = require('gulp-imagemin'),
  pngquant     = require('imagemin-pngquant'),
  cache        = require('gulp-cache'),
  autoprefixer = require('gulp-autoprefixer');

gulp.task('sass', function(){
  return gulp.src('app/sass/**/*.sass') 
    .pipe(sass()) 
    .pipe(autoprefixer(['last 15 versions', '> 1%', 'ie 8', 'ie 7'], { cascade: true })) 
    .pipe(gulp.dest('app/css')) 
    .pipe(browserSync.reload({stream: true}))
});

gulp.task('browser-sync', function() { 
  browserSync({ 
    server: { 
      baseDir: 'app' 
    },
    notify: false 
  });
});

gulp.task('scripts', function() {
  return gulp.src([ 
    'app/libs/jquery/dist/jquery.min.js', 
    'app/libs/magnific-popup/dist/jquery.magnific-popup.min.js'
    ])
    .pipe(concat('libs.min.js'))
    .pipe(uglify()) 
    .pipe(gulp.dest('app/js')); 
});

gulp.task('css-libs', ['sass'], function() {
  return gulp.src('app/css/libs.css') 
    .pipe(cssnano()) 
    .pipe(rename({suffix: '.min'}))
    .pipe(gulp.dest('app/css')); 
});

gulp.task('watch', ['browser-sync', 'css-libs', 'scripts'], function() {
  gulp.watch('app/sass/**/*.sass', ['sass']); 
  gulp.watch('app/*.html', browserSync.reload); 
  gulp.watch('app/js/**/*.js', browserSync.reload); 
});

gulp.task('clean', function() {
  return del.sync('dist'); 
});

gulp.task('img', function() {
  return gulp.src('app/img/**/*') 
    .pipe(cache(imagemin({ 
      interlaced: true,
      progressive: true,
      svgoPlugins: [{removeViewBox: false}],
      use: [pngquant()]
    })))
    .pipe(gulp.dest('dist/img'));
});

gulp.task('build', ['clean', 'img', 'sass', 'scripts'], function() {

  var buildCss = gulp.src([ 
    'app/css/main.css',
    'app/css/libs.min.css'
    ])
  .pipe(gulp.dest('dist/css'))

  var buildFonts = gulp.src('app/fonts/**/*') 
  .pipe(gulp.dest('dist/fonts'))

  var buildJs = gulp.src('app/js/**/*') 
  .pipe(gulp.dest('dist/js'))

  var buildHtml = gulp.src('app/*.html') 
  .pipe(gulp.dest('dist'));

});

gulp.task('clear', function (callback) {
  return cache.clearAll();
})

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

Please explain what needs to be done. Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sergey, 2016-04-11
@Alex_2222

Read here, I think you will understand stackoverflow you have a conflict between node and dependencies.

A
Alex_2222, 2016-04-11
@Alex_2222

Thank you!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question