简体   繁体   中英

Gulp event.js:163 throw err; // Unhandled 'error' event

I have taken git clone and run npm install without sudo, the same setup was working perfect on windows machine but its breaking on Mac OSX:

Here is my gulpfile.js

var gulp        =   require('gulp');

// Load plugins
var plugin = require('gulp-load-plugins')({
  pattern: '*'
});

var paths = {
  css:      'app/resources/css',
  sass:     'app/resources/scss',
  js:       'app/**/*.module.js, app/components/**/*.js',
  html:     'app/*.html'
};

//  Compile SASS using Compass,
//  Compass required as we using its utitlities
gulp.task('compass', function(){
  return gulp.src( paths.sass + '/*.scss' )
    .pipe(plugin.compass({
      css: paths.css,
      sass: paths.sass,
      task: 'watch',
      comments: false
    }));
});

// Watch task, keep checking for changes
gulp.task('watch', function(){
  gulp.watch([
    paths.sass + '/*.scss',
    paths.html,
    paths.js
  ]).on('change', plugin.browserSync.reload);
});

//  LiveReload Task
gulp.task('serve', function(){
    plugin.browserSync.init([], {
      server:  {
        baseDir: ['./', './app']
      }
  });
});

// Build HTML
gulp.task('html', function(){
  return gulp.src('app/*.html')
              .pipe(plugin.useref())
              .pipe(gulp.dest('dist'));
});

// Copy Images
gulp.task('images', function(){
  return gulp.src('app/resources/images/*')
            .pipe(gulp.dest('dist/resources/images/'));
});

// Copy Fonts
gulp.task('fonts', function(){
  return gulp.src('app/resources/fonts/*')
            .pipe(gulp.dest('dist/resources/fonts/'));
});

// Copy Templates
gulp.task('templates', function(){
  return gulp.src('app/components/**/*')
            .pipe(gulp.dest('dist/components/'));
});

// Clean
gulp.task('clean', function(){
  return gulp.src([
      'dist/base', 'dist/components', 'dist/resources'
    ], {
      read: false
    })
    .pipe( plugin.clean());
});

// Build
gulp.task('build', [ 'compass', 'html', 'images', 'fonts', 'templates', 'serve'])

// Default
gulp.task('default', ['clean'], function(){
    gulp.start('build');
});

I am getting following error on terminal, thinks path is picking wrong dont know where i made mistake:

events.js:163
      throw er; // Unhandled 'error' event
      ^

Error: Error: File not found with singular glob: /learning/recharge-desktop-code/learning/recharge-desktop-code/app/resources/css/common.css
    at DestroyableTransform.<anonymous> (/learning/recharge-desktop-code/node_modules/gulp-useref/index.js:65:28)
    at emitOne (events.js:101:20)
    at DestroyableTransform.emit (events.js:191:7)
    at emitOne (events.js:101:20)
    at Through2.emit (events.js:191:7)
    at OrderedStreams.<anonymous> (/learning/recharge-desktop-code/node_modules/gulp-useref/node_modules/glob-stream/index.js:140:20)
    at emitOne (events.js:96:13)
    at OrderedStreams.emit (events.js:191:7)
    at emitOne (events.js:96:13)
    at DestroyableTransform.emit (events.js:191:7)

奇怪,这是路径问题我已经改变了我的html中的css路径并且它工作了,而在Windows机器上不需要同样的,有人可以帮助理解这个吗?

Maybe is this problem. It's say

Thanks! We are aware of this issue and a fix is being worked on. Closing as this is a duplicate of #12841. Be on the lookout for the next v7.x release (which will probably be next week). Thanks!

https://github.com/nodejs/node/issues/13077

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM