最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - I am getting Malloc errors with gulp - Stack Overflow

programmeradmin1浏览0评论

Its interesting how I am getting Memory Allocation errors with gulp, regardless heres the output of the error:

gulp compile:development
[15:33:51] Warning: gulp version mismatch:
[15:33:51] Global gulp is 3.8.7
[15:33:51] Local gulp is 3.8.6
[15:33:52] Using gulpfile ~/Dropbox/AisisGit/Zen/gulpfile.js
[15:33:52] Starting 'bower'...
[15:33:52] Using cwd:  ./
[15:33:52] Using bower dir:  ./bower_components
[15:33:52] Starting 'compile:jsx'...
[15:33:52] Starting 'compile:js:development'...
[15:33:52] Starting 'compile:sass:development'...
[15:33:52] Starting 'serve'...
[15:33:52] Finished 'serve' after 1.88 ms
[15:33:52] Server started on 9010 port
[15:33:52] Finished 'compile:jsx' after 376 ms
[15:33:52] Finished 'compile:js:development' after 371 ms
[15:33:52] Starting 'watch:compilejs'...
[15:33:52] Finished 'watch:compilejs' after 6.4 μs
gulp(97412,0x7fff7ba57300) malloc: *** error for object 0x10598e5a9: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6

Now lets look at the gulp file it's self.

var gulp = require('gulp');
var bower = require('gulp-bower');
var serve = require('gulp-serve');
var concat = require('gulp-concat');
var sass = require('gulp-sass');
var ugly = require('gulp-uglify');
var minifyCss = require('gulp-minify-css');
var livereload = require('gulp-livereload');
var watch = require('gulp-watch');
var react = require('gulp-react');

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

gulp.task('compile:production',
  [
    'bower',
    'compile:jsx',
    'compile:js',
    'compile:sass',
  ]
);

gulp.task('compile:development',
  [
    'bower',
    'compile:jsx',
    'compile:js:development',
    'compile:sass:development',
    'serve',
    'watch'
  ]
);

gulp.task('watch:compilejs',
  [
    'compile:jsx',
    'compile:js:development',
  ]
);

gulp.task('watch:compilecss',
  [
    'compile:sass:development'
  ]
);

gulp.task('compile:sass', function() {
  return gulp.src([
    'src/css/*.scss'
    ]).pipe(concat('style.scss'))
    .pipe(sass())
    .pipe(minifyCss())
    .pipe(gulp.dest('dist/css/'))
});

gulp.task('compile:sass:development', function() {
  return gulp.src([
    'src/css/*.scss'
    ]).pipe(concat('style.css'))
    .pipe(sass())
    .pipe(gulp.dest('compiled/css/'))
});

gulp.task('compile:jsx', function() {
  return gulp.src([
    'src/js/**/*.jsx',
  ]).pipe(react())
    .pipe(gulp.dest('src/react-compiled/'))
});

gulp.task('compile:js', function() {

  return gulp.src([
    'src/js/**/*.js',
    'src/react-compiled/**/*.js'
  ]).pipe(concat('dist.js'))
    .pipe(ugly())
    .pipe(gulp.dest('dist/js/'));

});

gulp.task('compile:js:development', function() {

  return gulp.src([
    'src/js/**/*.js',
    'src/react-compiled/**/*.js'
  ]).pipe(concat('dist.js'))
    .pipe(gulp.dest('dist/js/'));

});

gulp.task('watch', ['watch:compilejs', 'watch:compilecss'], function() {
  var server = livereload();
  gulp.watch('src/js/**/*.js', ['watch:compilejs']);
  gulp.watch('src/js/**/*.js.jsx', ['watch:compilejs']);
  gulp.watch('src/css/**/*.scss', ['watch:compilecss']);
  gulp.watch('compiled/**').on('change', function(file) {
    server.changed(file.path);
  });
});

gulp.task('bower', function() {
  return bower({dir: './bower-components', cwd: './'});
});

gulp.task('serve', serve({
  root: 'compiled/',
  port: 9010,
}));

So clearly I am either doing some epically wrong to get Mem Allocation errors or There is something wrong at a much greater level. I use a similar gulp file for another project - the only difference is the other one has moving images and font files.

Any ways, is there something wrong with my gulp file or is there something much bigger here?

Its interesting how I am getting Memory Allocation errors with gulp, regardless heres the output of the error:

gulp compile:development
[15:33:51] Warning: gulp version mismatch:
[15:33:51] Global gulp is 3.8.7
[15:33:51] Local gulp is 3.8.6
[15:33:52] Using gulpfile ~/Dropbox/AisisGit/Zen/gulpfile.js
[15:33:52] Starting 'bower'...
[15:33:52] Using cwd:  ./
[15:33:52] Using bower dir:  ./bower_components
[15:33:52] Starting 'compile:jsx'...
[15:33:52] Starting 'compile:js:development'...
[15:33:52] Starting 'compile:sass:development'...
[15:33:52] Starting 'serve'...
[15:33:52] Finished 'serve' after 1.88 ms
[15:33:52] Server started on 9010 port
[15:33:52] Finished 'compile:jsx' after 376 ms
[15:33:52] Finished 'compile:js:development' after 371 ms
[15:33:52] Starting 'watch:compilejs'...
[15:33:52] Finished 'watch:compilejs' after 6.4 μs
gulp(97412,0x7fff7ba57300) malloc: *** error for object 0x10598e5a9: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6

Now lets look at the gulp file it's self.

var gulp = require('gulp');
var bower = require('gulp-bower');
var serve = require('gulp-serve');
var concat = require('gulp-concat');
var sass = require('gulp-sass');
var ugly = require('gulp-uglify');
var minifyCss = require('gulp-minify-css');
var livereload = require('gulp-livereload');
var watch = require('gulp-watch');
var react = require('gulp-react');

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

gulp.task('compile:production',
  [
    'bower',
    'compile:jsx',
    'compile:js',
    'compile:sass',
  ]
);

gulp.task('compile:development',
  [
    'bower',
    'compile:jsx',
    'compile:js:development',
    'compile:sass:development',
    'serve',
    'watch'
  ]
);

gulp.task('watch:compilejs',
  [
    'compile:jsx',
    'compile:js:development',
  ]
);

gulp.task('watch:compilecss',
  [
    'compile:sass:development'
  ]
);

gulp.task('compile:sass', function() {
  return gulp.src([
    'src/css/*.scss'
    ]).pipe(concat('style.scss'))
    .pipe(sass())
    .pipe(minifyCss())
    .pipe(gulp.dest('dist/css/'))
});

gulp.task('compile:sass:development', function() {
  return gulp.src([
    'src/css/*.scss'
    ]).pipe(concat('style.css'))
    .pipe(sass())
    .pipe(gulp.dest('compiled/css/'))
});

gulp.task('compile:jsx', function() {
  return gulp.src([
    'src/js/**/*.jsx',
  ]).pipe(react())
    .pipe(gulp.dest('src/react-compiled/'))
});

gulp.task('compile:js', function() {

  return gulp.src([
    'src/js/**/*.js',
    'src/react-compiled/**/*.js'
  ]).pipe(concat('dist.js'))
    .pipe(ugly())
    .pipe(gulp.dest('dist/js/'));

});

gulp.task('compile:js:development', function() {

  return gulp.src([
    'src/js/**/*.js',
    'src/react-compiled/**/*.js'
  ]).pipe(concat('dist.js'))
    .pipe(gulp.dest('dist/js/'));

});

gulp.task('watch', ['watch:compilejs', 'watch:compilecss'], function() {
  var server = livereload();
  gulp.watch('src/js/**/*.js', ['watch:compilejs']);
  gulp.watch('src/js/**/*.js.jsx', ['watch:compilejs']);
  gulp.watch('src/css/**/*.scss', ['watch:compilecss']);
  gulp.watch('compiled/**').on('change', function(file) {
    server.changed(file.path);
  });
});

gulp.task('bower', function() {
  return bower({dir: './bower-components', cwd: './'});
});

gulp.task('serve', serve({
  root: 'compiled/',
  port: 9010,
}));

So clearly I am either doing some epically wrong to get Mem Allocation errors or There is something wrong at a much greater level. I use a similar gulp file for another project - the only difference is the other one has moving images and font files.

Any ways, is there something wrong with my gulp file or is there something much bigger here?

Share Improve this question asked Oct 23, 2014 at 21:39 SeekingTruthSeekingTruth 1,0542 gold badges15 silver badges23 bronze badges 1
  • 1 I recently upgraded to Yosemite and started seeing the same error; has your OS changed recently? – Will Commented Oct 24, 2014 at 0:50
Add a comment  | 

3 Answers 3

Reset to default 22

I came to this site with the same problem. I've tried uninstalling/reinstalling and it didn't work.

I found this issue on their Github page: https://github.com/dlmanning/gulp-sass/issues/104

It looks like it might be a problem with the gulp-sass plugin and an empty files. Try to add a line in the .scss file and you should be set. It worked for me.

I think you may need to rebuild your modules.

I was seeing a very similar error after I upgraded to OS X Yosemite, though my problem was with gulp-sass.

Deleting node_modules and running npm install again resolved the problem for me.

2018 regression: https://github.com/sass/node-sass/issues/2280

Downgrade to "node-sass": "^4.7.2" until the fix is public.

发布评论

评论列表(0)

  1. 暂无评论