gulpevent.js:163抛出错误;//未处理';错误';事件
我在没有sudo的情况下使用git clone并运行npm安装,同样的安装在windows机器上运行得非常完美,但在Mac OSX上却出现了问题: 这是我的gulpfile.jsgulpevent.js:163抛出错误;//未处理';错误';事件,gulp,gulp-useref,Gulp,Gulp Useref,我在没有sudo的情况下使用git clone并运行npm安装,同样的安装在windows机器上运行得非常完美,但在Mac OSX上却出现了问题: 这是我的gulpfile.js var gulp = require('gulp'); // Load plugins var plugin = require('gulp-load-plugins')({ pattern: '*' }); var paths = { css: 'app/resources/c
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');
});
我在终端上遇到以下错误,认为路径选择错误不知道我在哪里出错:
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)
events.js:163
投掷者;//未处理的“错误”事件
^
错误:错误:找不到带有单数glob的文件:/learning/recharge desktop code/learning/recharge desktop code/app/resources/css/common.css
在一次彻底的变革中。(/learning/recharge desktop code/node_modules/gulp useref/index.js:65:28)
在emitOne(events.js:101:20)
位于DestroyableTransform.emit(events.js:191:7)
在emitOne(events.js:101:20)
在Through2.emit(events.js:191:7)
在OrderedStreams。(/learning/recharge desktop code/node_modules/gulp useref/node_modules/glob stream/index.js:140:20)
在emitOne(events.js:96:13)
在OrderedStreams.emit(events.js:191:7)
在emitOne(events.js:96:13)
位于DestroyableTransform.emit(events.js:191:7)
奇怪,是路径问题我更改了html中的css路径及其工作状态,而windows机器上不需要相同的路径,有人能帮助理解这一点吗?奇怪,是路径问题我更改了html中的css路径及其工作状态,而windows机器上不需要相同的路径,有人能帮助理解这一点吗?也许就是这个问题。
这是我说的
也许就是这个问题。
这是我说的
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!