Gulp注入:分段错误

时间:2016-06-14 15:34:37

标签: node.js linux npm segmentation-fault gulp-inject

我有manjaro linux,我从官方存储库中安装了nodejs和npm

节点版本:v6.2.1

npm版本:3.9.5

gulp.task('inject', ['scripts', 'styles'], function () {
        var injectStyles = gulp.src([
        path.join(conf.paths.tmp, '/serve/app/**/*.css'),
        path.join('!' + conf.paths.tmp, '/serve/app/vendor.css')
        ], { read: false });

        var injectScripts = gulp.src([
            path.join(conf.paths.src, '/app/**/*.module.js'),
            path.join(conf.paths.src, '/app/**/*.js'),
            path.join('!' + conf.paths.src, '/app/**/*.spec.js'),
            path.join('!' + conf.paths.src, '/app/**/*.mock.js'),
        ])
        .pipe($.angularFilesort()).on('error', conf.errorHandler('AngularFilesort'));
        var injectOptions = {
            ignorePath: [conf.paths.src, path.join(conf.paths.tmp, '/serve')],
            addRootSlash: false
        };

 return gulp.src(path.join(conf.paths.src, '/*.html'))
        .pipe($.inject(injectStyles, injectOptions))
        .pipe($.inject(injectScripts, injectOptions))
        .pipe(wiredep(_.extend({}, conf.wiredep)))
        .pipe(gulp.dest(path.join(conf.paths.tmp, '/serve')));
 });

当我跑步时:

$ gulp serve

它显示我:

[21:36:37] Using gulpfile /home/glats/Documents/Proyect/gulpfile.js
[21:36:37] Starting 'config'...
[21:36:37] Starting 'styles'...
[21:36:37] Finished 'config' after 236 ms
[21:36:37] Starting 'scripts'...
[21:36:37] gulp-inject 30 files into index.scss.
[21:36:39] Finished 'styles' after 2.36 s
[21:36:40] all files 211.97 kB
[21:36:40] Finished 'scripts' after 2.84 s
[21:36:40] Starting 'inject'...
[21:36:40] gulp-inject 1 files into index.html.
Segmentation fault

我的coredumctl告诉我:

          PID: 29909 (gulp)
          UID: 1000 (glats)
          GID: 1000 (glats)
       Signal: 11 (SEGV)
    Timestamp: lun 2016-06-13 18:03:49 CLT (3h 37min ago)
 Command Line: gulp                    
   Executable: /usr/bin/node
Control Group: /user.slice/user-1000.slice/session-c2.scope
         Unit: session-c2.scope
        Slice: user-1000.slice
      Session: c2
    Owner UID: 1000 (glats)
      Boot ID: 857cb1e6f9134beb91d172fc85f05f36
   Machine ID: 50f47fe8f80b4f92829b61933e8b309e
     Hostname: glats-pc
     Coredump: /var/lib/systemd/coredump/core.gulp.1000.857cb1e6f9134beb91d172fc85f05f36.29909.1465
   Message: Process 29909 (gulp) of user 1000 dumped core.

            Stack trace of thread 29909:
            #0  0x00002080c7ca188c n/a (n/a)

我成功运行gulp serve的唯一原因是从配置文件.pipe($.inject(injectScripts, injectOptions))中删除de follow line

1 个答案:

答案 0 :(得分:3)

我确实用n

做了
$ sudo npm install -g n
$ sudo n stable

install : node-v6.2.1
mkdir : /usr/local/n/versions/node/6.2.1
fetch : https://nodejs.org/dist/v6.2.1/node-v6.2.1-linux-x64.tar.gz 
######################################################################## 100,0%
installed : v6.2.1

最后我做$ gulp serve并完美地运行