javascript – 我收到了Malloc错误和gulp

栏目: C · 发布时间: 5年前

内容简介:我想你可能需要重建你的模块.我升级到OS X Yosemite之后看到了一个非常类似的错误,尽管我的问题是gulp-sass.删除node_modules并再次运行npm install解决了我的问题.

有趣的是我如何通过gulp获取内存分配错误,无论是错误的输出:

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

现在让我们看看它自己的gulp文件.

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,
}));

很明显,我或者做了一些严重的错误来获取内存分配错误或者在更高级别上出现了错误.我为另一个项目使用类似的gulp文件 – 唯一的区别是另一个有移动图像和字体文件.

无论如何,我的gulp文件有什么问题,或者这里有更大的东西?

我想你可能需要重建你的模块.

我升级到OS X Yosemite之后看到了一个非常类似的错误,尽管我的问题是gulp-sass.

删除node_modules并再次运行npm install解决了我的问题.

翻译自:https://stackoverflow.com/questions/26537928/i-am-getting-malloc-errors-with-gulp


以上所述就是小编给大家介绍的《javascript – 我收到了Malloc错误和gulp》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Real-Time Rendering, Third Edition

Real-Time Rendering, Third Edition

Tomas Akenine-Moller、Eric Haines、Naty Hoffman / A K Peters/CRC Press / 2008-7-25 / USD 102.95

Thoroughly revised, this third edition focuses on modern techniques used to generate synthetic three-dimensional images in a fraction of a second. With the advent or programmable shaders, a wide varie......一起来看看 《Real-Time Rendering, Third Edition》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具