akveo / ngx-admin

Customizable admin dashboard template based on Angular 10+
https://akveo.github.io/ngx-admin/
MIT License
25.28k stars 7.96k forks source link

ngx-admin prevents application start according to npm with code ELIFECYCLE and errno 137 #2033

Closed rajivpai06 closed 5 years ago

rajivpai06 commented 5 years ago

Issue type

I'm submitting a ... (check one with "x")

Issue description

I am trying to deploy an ngx-admin app on an Ubuntu 16.04 server but the application is not compiling.

Current behavior:

93% after chunk asset optimization SourceMapDevToolPlugin vendor.js generate SourceMapKilled                    
npm ERR! code ELIFECYCLE
npm ERR! errno 137
npm ERR! ngx-admin@3.0.0 start: `ng serve`
npm ERR! Exit status 137
npm ERR! 
npm ERR! Failed at the ngx-admin@3.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/rajiv/.npm/_logs/2019-02-05T03_32_01_489Z-debug.log

When I run with ng serve, compilation doesn't complete and I get the output below.

92% chunk asset optimization TerserPluginKilled

Expected behavior:

I expect the application to be compiled and run successfully.

** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **

Date: 2019-02-05T03:34:26.636Z
Hash: f9ea3d10031bd3cb9934
Time: 29727ms
chunk {app-admin-auth-auth-module} app-admin-auth-auth-module.js, app-admin-auth-auth-module.js.map (app-admin-auth-auth-module) 187 kB  [rendered]
chunk {app-admin-pages-pages-module} app-admin-pages-pages-module.js, app-admin-pages-pages-module.js.map (app-admin-pages-pages-module) 174 kB  [rendered]
chunk {app-customers-auth-auth-module} app-customers-auth-auth-module.js, app-customers-auth-auth-module.js.map (app-customers-auth-auth-module) 193 kB  [rendered]
chunk {app-customers-pages-pages-module} app-customers-pages-pages-module.js, app-customers-pages-pages-module.js.map (app-customers-pages-pages-module) 882 kB  [rendered]
chunk {common} common.js, common.js.map (common) 4.85 kB  [rendered]
chunk {main} main.js, main.js.map (main) 2.22 MB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 479 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 9 kB [entry] [rendered]
chunk {scripts} scripts.js, scripts.js.map (scripts) 1.3 MB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 3.95 MB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 10.9 MB [initial] [rendered]
ℹ 「wdm」: Compiled successfully.

Versions

Angular CLI: 7.0.5 Node: 10.15.1 OS: Ubuntu 16.04.5 LTS Angular: 7.0.3 Typescript: 3.1.3 Webpack: 4.29.0

Steps to reproduce:

This is a huge application now and I'm unable to provide a sample repository to run the application. But here are the steps that are followed from server setup to application startup:

Related code:

Not related code but here is a copy of a log generated by npm.

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
2 info using npm@6.4.1
3 info using node@v10.15.1
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle ngx-admin@3.0.0~prestart: ngx-admin@3.0.0
6 info lifecycle ngx-admin@3.0.0~start: ngx-admin@3.0.0
7 verbose lifecycle ngx-admin@3.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle ngx-admin@3.0.0~start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/opt/iot/project-frontend/node_modules/.bin:/home/rajiv/bin:/home/rajiv/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle ngx-admin@3.0.0~start: CWD: /opt/iot/project-frontend
10 silly lifecycle ngx-admin@3.0.0~start: Args: [ '-c', 'ng serve' ]
11 silly lifecycle ngx-admin@3.0.0~start: Returned: code: 137  signal: null
12 info lifecycle ngx-admin@3.0.0~start: Failed to exec start script
13 verbose stack Error: ngx-admin@3.0.0 start: `ng serve`
13 verbose stack Exit status 137
13 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:189:13)
13 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:189:13)
13 verbose stack     at maybeClose (internal/child_process.js:970:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid ngx-admin@3.0.0
15 verbose cwd /opt/iot/project-frontend
16 verbose Linux 4.4.0-141-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "start"
18 verbose node v10.15.1
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 137
22 error ngx-admin@3.0.0 start: `ng serve`
22 error Exit status 137
23 error Failed at the ngx-admin@3.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 137, true ]

Other information:

npm, node, OS, Browser

OS: Ubuntu 16.04.5 LTS Node: v10.15.1 Npm: 6.7.0

Angular, Nebular

Angular: 7.0.3 Nebular: 3.0.0

rajivpai06 commented 5 years ago

It turns out that the system was running out of memory and the kernel was killing ng serve. The solution is to run ng build --prod on your local system (with more RAM) then deploy the dist folder to the production system with limited resources.

This is obvious in hindsight since one should not deploy a development project to a live server.

mayijun0410 commented 5 years ago

Can you give me a webpackconfig for angular7 for this projetc