openMF / web-app

Mifos X Web App is the revamped version of the Mifos X Community App built on top of the Fineract Platform leveraging the popular Angular framework.
https://openmf.github.io/web-app/
Mozilla Public License 2.0
230 stars 523 forks source link

ng build --prod #739

Closed vorburger closed 4 years ago

vorburger commented 4 years ago

Now that I figured out #736, it crashes... :smiling_imp:

I'm a Java guy and a Noob to Node.JS - how does one fix something like this, or where to report?

$ ./node_modules/.bin/ng build --prod
 11% building 9/16 modules 7 active ...heme/custom/pictonblue-yellowgreen.scssBrowserslist: caniuse-lite is outdated. Please run next command `npm update`

<--- Last few GCs --->

[501755:0x55cb0ae00cb0]    33979 ms: Mark-sweep 2017.3 (2082.7) -> 2009.3 (2085.0) MB, 692.3 / 0.0 ms  (average mu = 0.121, current mu = 0.045) allocation failure scavenge might not succeed
[501755:0x55cb0ae00cb0]    34636 ms: Mark-sweep 2019.3 (2085.0) -> 2011.2 (2088.2) MB, 627.9 / 0.1 ms  (average mu = 0.081, current mu = 0.044) allocation failure GC in old space requested

<--- JS stacktrace --->

==== JS stack trace =========================================

    0: ExitFrame [pc: 0x7f61364c2959]
Security context: 0x1041083db089 <JSObject>
    1: normalizeString(aka normalizeString) [0x352492ac7f59] [path.js:~52] [pc=0x2c170409171c](this=0x2050177c04b1 <undefined>,0x33052dda5fe9 <String[106]: /home/vorburger/Mifos/web-app/node_modules/@fortawesome/angular-fontawesome/angular-fontawesome.ngfactory/>,0x2050177c06e9 <false>,0x0befb8a90441 <String[#1]: />,0x35f40e544bd1 <JSFunction isPosixPathSepa...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Writing Node.js report to file: report.20200506.031135.501755.0.001.json
Node.js report completed
 1: 0x7f61355f297c node::Abort() [/lib64/libnode.so.72]
 2: 0x7f61355f4ad5 node::OnFatalError(char const*, char const*) [/lib64/libnode.so.72]
 3: 0x7f6135975bda v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/lib64/libnode.so.72]
 4: 0x7f6135975e62 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/lib64/libnode.so.72]
 5: 0x7f6135b00b59  [/lib64/libnode.so.72]
 6: 0x7f6135b16a67 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/lib64/libnode.so.72]
 7: 0x7f6135b177dd v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/lib64/libnode.so.72]
 8: 0x7f6135b19a3c v8::internal::Heap::AllocateRawWithLightRetry(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/lib64/libnode.so.72]
 9: 0x7f6135b19aa8 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/lib64/libnode.so.72]
10: 0x7f6135ae07f1 v8::internal::Factory::AllocateRawWithImmortalMap(int, v8::internal::AllocationType, v8::internal::Map, v8::internal::AllocationAlignment) [/lib64/libnode.so.72]
11: 0x7f6135ae82e7 v8::internal::Factory::NewRawOneByteString(int, v8::internal::AllocationType) [/lib64/libnode.so.72]
12: 0x7f6135d2a5e0 v8::internal::String::SlowFlatten(v8::internal::Isolate*, v8::internal::Handle<v8::internal::ConsString>, v8::internal::AllocationType) [/lib64/libnode.so.72]
13: 0x7f6135e52e71 v8::internal::Runtime_StringCharCodeAt(int, unsigned long*, v8::internal::Isolate*) [/lib64/libnode.so.72]
14: 0x7f61364c2959  [/lib64/libnode.so.72]
vorburger commented 4 years ago

It produced a report.20200506.031135.501755.0.001.json - am I supposed to perhaps upload that, somewhere, for analysis?

BTW my /usr/bin/npm --version says I (currently) have 6.13.4. In ./bin/npm -version I seem to have a slightly newer 6.14.5, but I don't understand how to use that, what am I missing here:

$ bin/npm run-script build --prod

> mifosx-web-app@0.0.0 build /home/vorburger/Mifos/web-app
> npm run env -s && ng build --prod --output-hashing=none

Schema validation failed with the following errors:
  Data path ".builders['app-shell']" should have required property 'class'.
Error: Schema validation failed with the following errors:
  Data path ".builders['app-shell']" should have required property 'class'.
    at MergeMapSubscriber.project (/home/vorburger/Mifos/web-app/node_modules/@angular/cli/node_modules/@angular-devkit/core/src/workspace/workspace.js:215:42)
    at MergeMapSubscriber._tryNext (/home/vorburger/Mifos/web-app/node_modules/@angular/cli/node_modules/rxjs/internal/operators/mergeMap.js:69:27)
    at MergeMapSubscriber._next (/home/vorburger/Mifos/web-app/node_modules/@angular/cli/node_modules/rxjs/internal/operators/mergeMap.js:59:18)
    at MergeMapSubscriber.Subscriber.next (/home/vorburger/Mifos/web-app/node_modules/@angular/cli/node_modules/rxjs/internal/Subscriber.js:67:18)
    at MergeMapSubscriber.notifyNext (/home/vorburger/Mifos/web-app/node_modules/@angular/cli/node_modules/rxjs/internal/operators/mergeMap.js:92:26)
    at InnerSubscriber._next (/home/vorburger/Mifos/web-app/node_modules/@angular/cli/node_modules/rxjs/internal/InnerSubscriber.js:28:21)
    at InnerSubscriber.Subscriber.next (/home/vorburger/Mifos/web-app/node_modules/@angular/cli/node_modules/rxjs/internal/Subscriber.js:67:18)
    at MapSubscriber._next (/home/vorburger/Mifos/web-app/node_modules/@angular/cli/node_modules/rxjs/internal/operators/map.js:55:26)
    at MapSubscriber.Subscriber.next (/home/vorburger/Mifos/web-app/node_modules/@angular/cli/node_modules/rxjs/internal/Subscriber.js:67:18)
    at SwitchMapSubscriber.notifyNext (/home/vorburger/Mifos/web-app/node_modules/@angular/cli/node_modules/rxjs/internal/operators/switchMap.js:86:26)
    at InnerSubscriber._next (/home/vorburger/Mifos/web-app/node_modules/@angular/cli/node_modules/rxjs/internal/InnerSubscriber.js:28:21)
    at InnerSubscriber.Subscriber.next (/home/vorburger/Mifos/web-app/node_modules/@angular/cli/node_modules/rxjs/internal/Subscriber.js:67:18)
    at /home/vorburger/Mifos/web-app/node_modules/@angular/cli/node_modules/rxjs/internal/util/subscribeTo.js:17:28
    at Object.subscribeToResult (/home/vorburger/Mifos/web-app/node_modules/@angular/cli/node_modules/rxjs/internal/util/subscribeToResult.js:10:45)
    at SwitchMapSubscriber._innerSub (/home/vorburger/Mifos/web-app/node_modules/@angular/cli/node_modules/rxjs/internal/operators/switchMap.js:65:54)
    at SwitchMapSubscriber._next (/home/vorburger/Mifos/web-app/node_modules/@angular/cli/node_modules/rxjs/internal/operators/switchMap.js:55:14)
    at SwitchMapSubscriber.Subscriber.next (/home/vorburger/Mifos/web-app/node_modules/@angular/cli/node_modules/rxjs/internal/Subscriber.js:67:18)
    at SwitchMapSubscriber.notifyNext (/home/vorburger/Mifos/web-app/node_modules/@angular/cli/node_modules/rxjs/internal/operators/switchMap.js:86:26)
    at InnerSubscriber._next (/home/vorburger/Mifos/web-app/node_modules/@angular/cli/node_modules/rxjs/internal/InnerSubscriber.js:28:21)
    at InnerSubscriber.Subscriber.next (/home/vorburger/Mifos/web-app/node_modules/@angular/cli/node_modules/rxjs/internal/Subscriber.js:67:18)
    at /home/vorburger/Mifos/web-app/node_modules/@angular/cli/node_modules/rxjs/internal/util/subscribeTo.js:17:28
    at Object.subscribeToResult (/home/vorburger/Mifos/web-app/node_modules/@angular/cli/node_modules/rxjs/internal/util/subscribeToResult.js:10:45)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mifosx-web-app@0.0.0 build: `npm run env -s && ng build --prod --output-hashing=none`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the mifosx-web-app@0.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

also not:

$ bin/npm run-script ./node_modules/@angular/cli/bin/ng build --prod
npm ERR! missing script: ./node_modules/@angular/cli/bin/ng

@edewit hey my friend, I have a feeling you may happen to have an idea re. what to do about this kinda thing? :smiley:

BLasan commented 4 years ago

@vorburger Update your @angular-devkit/build-angular corresponding to the node version you use

vorburger commented 4 years ago

I don't know what that means... ;-)

How does one find an "angular-devkit/build-angular corresponding to the node version"?

edewit commented 4 years ago

6.13.4 is a about half a year old and version 6.14.5 is very recent (don't think that is the problem though). Make sure you have run a npm install, maybe remove your node_modules folder before. I also had some problem building with the latest version of nodejs. I use nvm to switch versions. With nodejs version v10.20.1 I was able to do a prod build. The command you should be using would be npm run build:prod (see package.json) it passes some more arguments to the ng command then just --prod

karantakalkar commented 4 years ago

@vorburger fixed by: #437