我遇到使用gulp运行Anguler 1.2应用程序的问题,引发跟踪错误。 Build是其他开发人员的开发人员,我并不擅长。
我尝试运行npm install,bower update。 没有任何效果。
任何建议都会有所帮助。
请查看以下错误输出和代码。
感谢。 events.js:141 扔掉//未处理的'错误'事件 ^
Error: watch /home/web/src/ ENOSPC
at exports._errnoException (util.js:907:11)
at FSWatcher.start (fs.js:1234:19)
at Object.fs.watch (fs.js:1262:11)
at Gaze._watchDir (/home/web/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:289:30)
at /home/web/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:358:10
at iterate (/home/web/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/helper.js:52:5)
at Object.forEachSeries (/home/web/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/helper.js:66:3)
at Gaze._initWatched (/home/web/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:354:10)
at Gaze.add (/home/web/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:177:8)
at new Gaze (/home/web/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:74:10)
- Gulp档案--------------------------
var Gulp = require('gulp');
var Less = require('gulp-less');
var Path = require('path');
var JShint = require('gulp-jshint');
var Browserify = require('browserify');
var Sourcemaps = require('gulp-sourcemaps');
var Source = require('vinyl-source-stream');
var MinifyHTML = require('gulp-minify-html');
var RunSequence = require('run-sequence');
/**
* HTML template task + watch
*/
Gulp.task('templates', function () {
// Get our index.html
// find options here: https://www.npmjs.com/package/gulp-minify-html
var opts = {};
Gulp.src('src/index.html')
// And put it in the public folder
// .pipe(MinifyHTML(opts))
.pipe(Gulp.dest('public/'));
Gulp.src('src/index.php')
// And put it in the public folder
// .pipe(MinifyHTML(opts))
.pipe(Gulp.dest('public/'));
// Any other view files from src/templates
return Gulp.src('src/templates/**/*.html')
// Will be put in the public/templates folder
// .pipe(MinifyHTML(opts))
.pipe(Gulp.dest('public/templates/'));
});
Gulp.watch(['src/index.php', 'src/index.html', 'src/templates/**/*.html'], {interval: 500}, [
'templates'
]);
/**
* LESS / CSS task + watch
*/
Gulp.task('css', function () {
return Gulp.src('src/css/*.css*')
.pipe(Gulp.dest('./public/css'));
});
Gulp.watch(['src/css/*.css*'], {interval: 500}, [
'css'
]);
Gulp.task('less', function () {
return Gulp.src('src/css/less/*.less')
.pipe(Sourcemaps.init())
.pipe(Less({
paths: [Path.join(__dirname, 'less', 'includes')]
}))
.pipe(Sourcemaps.write())
.pipe(Gulp.dest('./public/css'));
});
Gulp.watch(['src/css/**/*.less'], {interval: 500}, [
'less'
]);
/**
* Images task + watch
*/
// Image "copy" / "optimize" task
Gulp.task('images', function () {
// Get our images
return Gulp.src('src/img/**/*')
// Do some optional image processing here, such as optimizing
// And put it in the dist folder
.pipe(Gulp.dest('public/img/'))
});
Gulp.watch(['src/img/**/*'], {interval: 1000}, ['images']);
/**
* Font task + watch
*/
Gulp.task('fonts', function () {
// Get our fonts
return Gulp.src('src/fonts/**/*')
// Do some optional image processing here, such as optimizing
// And put it in the dist folder
.pipe(Gulp.dest('public/fonts/'))
});
Gulp.watch(['src/fonts/**/*'], {interval: 1000}, ['fonts']);
/**
* JS tasks + watches
*/
// linting
Gulp.task('lint', function () {
return;
Gulp.src('src/js/**/*.js')
.pipe(JShint())
// You can look into pretty reporters as well, but that's another story
.pipe(JShint.reporter('default'));
});
// Browserify task
Gulp.task('l10n', function () {
return Gulp.src('src/js/l10n/*.js')
.pipe(Gulp.dest('public/js/l10n/'));
});
// Browserify task
Gulp.task('browserify', function () {
var b = Browserify({
basedir: './',
entries: './src/js/main.js',
debug: true,
insertGlobals: true
});
b.transform('deamdify');
/* b.transform({
global: true
}, ngAnnotate);*/
/* b.transform({
global: true
}, uglifyify);*/
return b.bundle()
.on('error', function (err) {
// print the error (can replace with gulp-util)
console.log(err.message);
// end this stream
this.end();
})
.pipe(Source('bundle.js'))
// .pipe(streamify(rename({suffix: '.min'})))
.pipe(Gulp.dest('public/js'));
});
Gulp.task('javascript', ['lint'], function () {
// Watch our scripts
Gulp.watch(['src/js/*.js', 'src/js/**/*.js'], {interval: 500}, [
'lint',
'browserify',
'l10n'
]);
});
/**
* Copy vendor JS
*/
Gulp.task('vendor', function () {
// Get our images
return Gulp.src('src/vendor/**/*')
// Do some optional image processing here, such as optimizing
// And put it in the dist folder
.pipe(Gulp.dest('public/vendor/'));
});
Gulp.watch(['src/vendor/**/*'], {interval: 2000}, ['vendor']);
/**
* default task, start with "gulp"
*/
Gulp.task('default', ['css', 'less', 'images', 'javascript', 'templates', 'fonts', 'vendor'], function () {
// we depend on 'watch' tasks, so nothing to do really
});
Gulp.task('build', function () {
RunSequence(
'css',
//'less',
'images',
'browserify',
'l10n',
'templates',
'fonts',
'vendor',
function(){
console.log('Build completed, closing');
process.exit(0);
});
});