Ionic serve error without for no apparent reason

Hello, I have an Ionic project together with Angular and Capacitor.

Everything was working correctly, when suddenly without touching any code or updating anything the following error appeared when I launch an Ionic serve:

[ng] #
[ng] # Fatal error in , line 0
[ng] # Fatal JavaScript invalid size error 169231025
[ng] #
[ng] #
[ng] #
[ng] #FailureMessage Object: 00000062EC1FE500
[ng]  1: 00007FF745A2190F node_api_throw_syntax_error+203775
[ng]  2: 00007FF74593292F v8::CTypeInfoBuilder<void>::Build+11951
[ng]  3: 00007FF7467A1262 V8_Fatal+162
[ng]  4: 00007FF7462E2FC5 v8::internal::FactoryBase<v8::internal::Factory>::NewFixedArray+101
[ng]  5: 00007FF746168643 v8::internal::FeedbackNexus::ic_state+65795
[ng]  6: 00007FF7461871C0 v8::debug::Script::GetIsolate+15600
[ng]  7: 00007FF745FD3920 v8::internal::CompilationCache::IsEnabledScriptAndEval+25952
[ng]  8: 00007FF7464E03F1 v8::internal::SetupIsolateDelegate::SetupHeap+558193
[ng]  9: 00007FF6C6F0E64A

[ERROR] ng has unexpectedly closed (exit code 2147483651).

        The Ionic CLI will exit. Please check any output above for error details.

I have tried to reinstall node but without success.

Any help will be welcome. Thank you.

What are your node, npm and ng versions?
The error is coming from ng (angular CLI), which is called internally by Ionic CLI to build the app.

Hello,

node: v18.11.0

npm: 8.19.2

ng angular info:

Angular CLI: 15.1.6
Node: 18.11.0
Package Manager: npm 8.19.2
OS: win32 x64

Angular: 15.1.5
… common, compiler, compiler-cli, core, forms
… language-service, platform-browser, platform-browser-dynamic
… router

Package Version

@angular-devkit/architect 0.1501.6
@angular-devkit/build-angular 15.1.6
@angular-devkit/core 15.1.6
@angular-devkit/schematics 15.1.6
@angular/cli 15.1.6
@schematics/angular 15.1.6
rxjs 7.5.7
typescript 4.8.4

And this is a extra info about Ionic and Capacitor:

Ionic:

Ionic CLI : 6.20.8 (C:\Users**\AppData\Roaming\npm\node_modules@ionic\cli)
Ionic Framework : @ionic/angular 6.5.5
@angular-devkit/build-angular : 15.1.6
@angular-devkit/schematics : 15.1.6
@angular/cli : 15.1.6
@ionic/angular-toolkit : 6.1.0

Capacitor:

Capacitor CLI : 4.6.3
@capacitor/android : 4.6.3
@capacitor/core : 4.6.3
@capacitor/ios : not installed

Utility:

cordova-res : not installed globally
native-run : 1.7.1

System:

NodeJS : v18.11.0 (C:\Program Files\nodejs\node.exe)
npm : 8.19.2

Thanks!

Can you try updating the angular CLI to 15.2.8? and probably all the other packages that start with @angular to their latest 15.x version available (not to the latest as it’s 16 now)