Gulp Segmentation Fault 11,Abort Trap 6

时间:2015-08-29 17:34:52

标签: segmentation-fault gulp abort gulp-watch

当其中一个gulp.watch任务被解雇时(主要是css:dist),我收到以下错误之一:Abort Trap 6Segmentation fault: 11。此外,它只发生过一次,但在Gulp暂停后显示另一条错误消息:Trace/BPT trap: 5。但是,段错误是我最常遇到的错误。 Gulp可能每4或5次停止我修改/保存一个正在监视的SCSS文件。对于其他正在观看的文件,我也遇到过这种情况。

我已经尝试了一切。 brew upgradebrew update似乎没有改善任何事情。我已经尝试清除项目中的所有节点模块并重新安装,更新所有这些软件包,重新启动计算机,验证磁盘权限等。没有任何帮助。

当我偶然发现this question时,我以为我找到了答案,但是没有得到答案并且处于休眠状态。 GitHub上的一些未解决的问题表明它可能是Gaze,gulp-sass或rtorrent in Homebrew的错(我不认为我使用它,除非它是依赖项)。

在Mac OSX Yosemite上运行。这是我的Gulpfile:

var fs = require('fs'),
  argv = require('yargs').argv,
  browserify = require('browserify'),
  transform = require('vinyl-transform'),
  browserSync = require('browser-sync'),
  gulp = require('gulp'),
  del = require('del'),
  sass = require('gulp-sass'),
  prefixer = require('gulp-autoprefixer'),
  sourcemaps = require('gulp-sourcemaps'),
  concat = require('gulp-concat'),
  uglify = require('gulp-uglify'),
  minify = require('gulp-minify-css'),
  imagemin = require('gulp-imagemin'),
  rename = require('gulp-rename'),
  config = {
    browserSync_proxy: 'dev.example.com',
    bower_path: './bower_components/',
    template_src: ['resources/views/*.blade.php', 'resources/views/**/*.blade.php'],
    js_src: ['resources/assets/js/*.js', 'resources/assets/js/**/*.js'],
    sass_src: ['resources/assets/scss/*.scss', 'resources/assets/scss/**/*.scss'],
    img_src: ['resources/assets/img/**/*', 'resources/assets/img/*'],
    js_dist: 'public/assets/js/',
    js_clean_path: 'public/assets/js/**/*',
    css_dist: 'public/assets/css/',
    css_clean_path: 'public/assets/css/**/*',
    img_dist: 'public/assets/img/'
  };
/*
 ** Update bower component path if .bowerrc file exists
 */
if (fs.existsSync('.bowerrc')) {
  var bower_config = JSON.parse(fs.readFileSync('.bowerrc')),
    bower_dir = bower_config.directory;
  config.bower_path = (bower_dir.substr(bower_dir.length, -1) !== "/") ? bower_dir + "/" : bower_dir;
}
/*
** Start browser sync
*/
if(argv.sync !== 0) {
  browserSync({
    proxy: config.browserSync_proxy,
    host: config.browserSync_proxy,
    open: 'external'
  });
}
/*
 ** CSS: Clean destination folder before processing css
 */
gulp.task('css:clean', function() {
  del([config.css_clean_path], function(err,paths) {
      console.log("Cleaned CSS:\n", paths.join('\n'));
  });
});
/*
 ** CSS: Compile sass, add autoprefixer and minify
 */
gulp.task('css:dist', ['css:clean'], function() {
  return gulp.src(config.sass_src)
  .pipe(sourcemaps.init())
  .pipe(sass({
    sourceComments: 'none',
    includePaths: [
      config.bower_path + 'normalize-scss',
      config.bower_path + 'bourbon/app/assets/stylesheets',
      config.bower_path + 'neat/app/assets/stylesheets',
      config.bower_path + 'slick-carousel/slick'
    ]
  }))
  .pipe(prefixer({
    browsers: ['last 2 versions']
  }))
  .pipe(minify({
    keepSpecialComments: 0
  }))
  .pipe(sourcemaps.write('.'))
  .pipe(gulp.dest(config.css_dist));
});
/*
 ** JS: Clean js folder before processing scripts
 */
gulp.task('js:clean', function() {
  del([config.js_clean_path], function(err,paths) {
      console.log("Cleaned JS:\n", paths.join('\n'));
  });
});
/*
 ** JS: Combine vendor js files
 */
gulp.task('js:vendor', function() {
  return gulp.src([
      config.bower_path + 'jquery/dist/jquery.js',
      config.bower_path + 'modernizr/modernizr.js',
      config.bower_path + 'fastclick/lib/fastclick.js',
      config.bower_path + 'slick-carousel/slick/slick.js',
      config.bower_path + 'frame-events/frame-events.js'
  ])
  .pipe(concat('vendor.js'))
  .pipe(uglify())
  .pipe(rename({
      suffix: '.min'
  }))
  .pipe(gulp.dest(config.js_dist));
});
/*
 ** JS: Build via Browserify
 */
gulp.task('js:browserify', function() {
  var browserifyTrans = transform(function(file) {
    var browserified = browserify(file);
    return browserified.bundle();
  });    

  return gulp.src([config.js_src[0]])
    .pipe(browserifyTrans)
    .pipe(gulp.dest(config.js_dist));
});
/*
 ** JS: Build main app files via browserify
 */
gulp.task('js:dist', ['js:clean', 'js:vendor', 'js:browserify'], function() {
  return gulp.src([config.js_dist + '/**/*.js'])
    .pipe(uglify())
    .pipe(rename({
      suffix: '.min'
    }))
    .pipe(gulp.dest(config.js_dist));
});    

/*
 ** IMG: Run imagemin on all images
 */
gulp.task('img:dist', function() {
  gulp.src(config.img_src).pipe(imagemin({
    optimizationLevel: 0,
    progressive: true,
    svgoPlugins: [{
      removeViewBox: false
    }, {
      removeEmptyAttrs: true
    }, {
      collapseGroups: false
    }]
  }))
  .pipe(gulp.dest(config.img_dist));
});
/*
 ** Default Task
 */
gulp.task('default', ['css:dist', 'js:dist', 'img:dist'], function() {
  /*
  ** Initial file observers
  */
  gulp.watch(config.js_src, ['js:dist']);
  gulp.watch(config.sass_src, ['css:dist']);
  gulp.watch(config.img_src, ['img:dist']);
  gulp.watch([
    config.template_src,
    config.js_dist + '*.js',
    config.css_dist + '*.css'
  ]).on('change', browserSync.reload);
});

Example of Segmentation fault: 11 error I'm getting frequently

有人知道可能会导致什么?在此先感谢您看一下。

更新 ::我已经在我的机器上安装了GDB,希望能够找到问题,但GDB似乎没有承认现场直播来自Gulp的watch更新,所以没有帮助。有人知道如何让GDB允许遵守这些gulp.watch任务吗?

0 个答案:

没有答案