Node.js 大口鱼被不定期杀死

Node.js 大口鱼被不定期杀死,node.js,gulp,Node.js,Gulp,我在运行gulp时遇到了一个问题,因为它在任务期间会自杀。我什么都没做: > gulp build [11:25:34] Using gulpfile /app/app-base/frontend/gulpfile.js [11:25:34] Starting 'css-clean'... [11:25:34] Starting 'js-clean'... [11:25:34] Finished 'css-clean' after 5.99 ms [11:25:34] Starting

我在运行gulp时遇到了一个问题,因为它在任务期间会自杀。我什么都没做:

> gulp build

[11:25:34] Using gulpfile /app/app-base/frontend/gulpfile.js
[11:25:34] Starting 'css-clean'...
[11:25:34] Starting 'js-clean'...
[11:25:34] Finished 'css-clean' after 5.99 ms
[11:25:34] Starting 'css-build'...
[11:25:34] Finished 'js-clean' after 17 ms
[11:25:34] Starting 'js-build'...
[11:25:35] Finished 'css-build' after 888 ms
[11:25:35] Starting 'css'...
[11:25:35] Finished 'css' after 13 μs
Killed

npm ERR! app-frontend@0.0.1 build: `gulp build`
npm ERR! Exit status 137
npm ERR! 
npm ERR! Failed at the app-frontend@0.0.1 build script.
npm ERR! This is most likely a problem with the app-frontend package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     gulp build
npm ERR! You can get their info via:
npm ERR!     npm owner ls app-frontend
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.13.0-43-generic
npm ERR! command "/root/.nvm/v0.10.35/bin/node" "/root/.nvm/v0.10.35/bin/npm" "run" "build"
npm ERR! cwd /app/app-base/frontend
npm ERR! node -v v0.10.35
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /app/app-base/frontend/npm-debug.log
npm ERR! not ok code 0
这是我的js构建任务,似乎是原因:

gulp.task('js-build', ['js-clean'], function() {                                 
    return gulp                                                                  
        .src(PATHS.js.input)                                                     
        .pipe(plumber())                                                         
        .pipe(browserify({                                                       
            transform: [                                                         
                'reactify',                                                      
                'envify',                                                        
            ],                                                                   
        }))                                                                      
        .pipe(rename(PATHS.js.outputFile))                                       
        .pipe(uglify())                                      
        .pipe(gulp.dest(PATHS.js.output));                                       
}); 
如果我去掉丑陋,它会更有效,但它不能100%有效。这可能与所花的时间有关,似乎与此相关


以下是npm-debug.log:

 1  0 info it worked if it ends with ok
 2  1 verbose cli [ '/root/.nvm/v0.10.35/bin/node',
 3  1 verbose cli   '/root/.nvm/v0.10.35/bin/npm',
 4  1 verbose cli   'start' ]
 5  2 info using npm@1.4.28
 6  3 info using node@v0.10.35
 7  4 verbose run-script [ 'prestart', 'start', 'poststart' ]
 8  5 info prestart app-base@
 9  6 info start app-base@
10  7 verbose unsafe-perm in lifecycle true
11  8 info app-base@ Failed to exec start script
12  9 error app-base@ start: `./scripts/start.sh`
13  9 error Exit status 1
14  10 error Failed at the app-base@ start script.
15  10 error This is most likely a problem with the app-base package,
16  10 error not with npm itself.
17  10 error Tell the author that this fails on your system:
18  10 error     ./scripts/start.sh
19  10 error You can get their info via:
20  10 error     npm owner ls app-base
21  10 error There is likely additional logging output above.
22  11 error System Linux 3.13.0-43-generic
23  12 error command "/root/.nvm/v0.10.35/bin/node" "/root/.nvm/v0.10.35/bin/npm" "start"
24  13 error cwd /app/app-base
25  14 error node -v v0.10.35
26  15 error npm -v 1.4.28
27  16 error code ELIFECYCLE
28  17 verbose exit [ 1, true ]

不幸的是,
Killed
是由内核引起的,并且是由于机器内存耗尽。这是在512Mb虚拟机上完成的,内存不足以进行gulp构建。我必须在另一台机器上进行捆绑,并将代码作为一种变通方法转移到这台机器上,而不是简单地给机器更多内存,这也会起作用。希望能帮助别人…

我也面临同样的问题。我有一个1GB的ram服务器,gulp进程被终止。我在生产模式下禁用了任何起毛任务,这大大减少了内存消耗。

共享此功能….-
/app/app base/frontend/npm debug.log
除了控制台日志所说的内容之外,它没有说更多的内容,但可以肯定。给我一点时间。添加nom-debug.log文件。将返回语句分解为多个部分(通过为每个转换的管道分配变量,为每个步骤添加日志,如
console.log(“Starting Plumberer”);
和console.log(“Finished Plumberer”);以便我们可以确定故障所在。