当 运行 gulp/nodemon 时设置 --max_old_space_size
Set --max_old_space_size when running gulp/nodemon
我的 gulp 进程中有一个 gulp-nodemon 任务。当我运行这个过程时,它给出了一个错误FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
。我想我必须设置 max_old_space_size
来解决这个问题。但是,该进程是由 nodemon 而不是 node 驱动的。如何在 gulp/nodemon 任务中设置选项?这是我的 gulp/nodemon 任务:
module.exports = {
waitForHapi: _waitForHapi,
nodemon: function () {
return nodemon({
script: 'server/server.js',
ext: 'js',
ignore: ['client', 'dist', 'node_modules', 'gulpfile.js']
})
.on('start', function () {
fs.writeFileSync('.server-refresh', 'waiting');
if (!openOpts.already) {
openOpts.already = true;
_waitForHapi(function () {
gulp.src('client/index.html')
.pipe(open('', openOpts));
});
} else {
_waitForHapi(bwsrsync.reload);
}
});
}
来自
I just found out today that gulp can be given any V8 option and it will be passed to node. For example, do gulp yourTask --max_old_space_size=2000 and it will give you the results you want. To see a list of V8 flags to pass, type node --v8-options in your terminal.
我的 gulp 进程中有一个 gulp-nodemon 任务。当我运行这个过程时,它给出了一个错误FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
。我想我必须设置 max_old_space_size
来解决这个问题。但是,该进程是由 nodemon 而不是 node 驱动的。如何在 gulp/nodemon 任务中设置选项?这是我的 gulp/nodemon 任务:
module.exports = {
waitForHapi: _waitForHapi,
nodemon: function () {
return nodemon({
script: 'server/server.js',
ext: 'js',
ignore: ['client', 'dist', 'node_modules', 'gulpfile.js']
})
.on('start', function () {
fs.writeFileSync('.server-refresh', 'waiting');
if (!openOpts.already) {
openOpts.already = true;
_waitForHapi(function () {
gulp.src('client/index.html')
.pipe(open('', openOpts));
});
} else {
_waitForHapi(bwsrsync.reload);
}
});
}
来自
I just found out today that gulp can be given any V8 option and it will be passed to node. For example, do gulp yourTask --max_old_space_size=2000 and it will give you the results you want. To see a list of V8 flags to pass, type node --v8-options in your terminal.