Gulp Watch에서 여러 번 다시 시작한 후 메모리 누수가 발생할 수 있다는 경고 메시지가 나타납니다. 모든 재시작마다 꿀꺽 꿀꺽 마심 시계의 새로운 인스턴스를 시작하고 새로운 서버와 또 다른 새로운 시계를 반복적으로 트리거하기 때문에 그럴 것이라고 생각합니다. 그게 사실인지 모르겠다면 그 문제를 해결하는 방법을 모르겠습니다.Gulp Watch에서 메모리 누수가 발생합니다.
여기 내 gulpfile.js입니다.
const gulp = require('gulp');
const exec = require('child_process').exec;
const gutil = require('gulp-util');
const eslint = require('gulp-eslint');
gulp.task('dev', (() => {
gulp.start('test');
gulp.start('lint');
gulp.start('server');
gulp.start('watch');
return gutil.log('Gulp is running!');
}));
gulp.task('server', (cb) => {
exec('npm start', (err, stdout, stderr) => {
gutil.log(stdout);
gutil.log(stderr);
cb(err);
});
});
gulp.task('test', (cb) => {
exec('npm test', (err, stdout, stderr) => {
gutil.log(stdout);
gutil.log(stderr);
cb(err);
});
});
gulp.task('watch',() => {
gulp.watch(['./app.js', './views/*', './routes/*'], ['dev']);
});
gulp.task('lint',() => {
return gulp.src(['**/*.js', '!node_modules/**'])
.pipe(eslint())
.pipe(eslint.format());
});
그리고 내 오류는 다음과 같습니다
(node:808) Warning: Possible EventEmitter memory leak detected. 11 change listeners added. Use emitter.setMaxListeners() to increase limit
나는 경고를 추가했습니다. – loganhuskins