x)
Yes, the previous version in which this bug was not present was: 9.0.2
After updating @angular/compiler-cli 9.0.3 during ng serve I receive following error: ERROR in Maximum call stack size exceeded
ERROR in Maximum call stack size exceeded## π Your Environment
ng version
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ β³ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 9.0.3
Node: 12.13.1
OS: linux x64
Angular: 9.0.3
... animations, cli, common, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.900.3
@angular-devkit/build-angular 0.900.3
@angular-devkit/build-optimizer 0.900.3
@angular-devkit/build-webpack 0.900.3
@angular-devkit/core 9.0.3
@angular-devkit/schematics 9.0.3
@angular/cdk 9.1.0
@angular/compiler 9.0.2
@angular/material 9.1.0
@ngtools/webpack 9.0.3
@schematics/angular 9.0.3
@schematics/update 0.900.3
rxjs 6.5.4
typescript 3.7.5
webpack 4.41.2
Anything else relevant?
Some other people reported that deleting their node_modules and re-installing got rid of this error... can you try that?
I was getting this error when running ngcc during postinstall. Removing node_modules fixed that.
However, I can confirm that the error persists when running ng serve or ng build.
I can also confirm that the issue does not occur with Ivy disabled ("enableIvy": false) nor with version 9.0.2.
Reported error as #35721 now closed
Since then I downgraded to 9.0.2 and reinstalled node -modules-> the bug is present in 9.0.2 - not a regression for me.
Reinstalled 9.0.3 and deleted and reinstalled node-modules - > same error
There is a repro with #35721
In all cases for me ng serve and ng build work. ng build --prod does not work memory error in terser
Some other people reported that deleting their
node_modulesand re-installing got rid of this error... can you try that?
@petebacondarwin I don't receive that error any more after removing node_modules. I've had similar issue during building ng library when typescript files resided in directory with identical name. Maybe its some clue?
Same as #17115 and angular/angular#35709
I had to delete node_modules and reinstall (with npm ci) to fix the error, which was happening with all the third-party libs except Material.
But while the error is gone, during Ivy compilation on first serve/build, my computer heated as hell (which never happen usually, I have a very recent Macbook Pro). I had to close a process in Monitor Activity to make the heat stop. So it's seems there is a memory leak somewhere.
ng version:
Angular CLI: 9.0.4
Node: 12.16.1
OS: darwin x64
Angular: 9.0.4
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router, service-worker
Ivy Workspace: Yes
Package Version
------------------------------------------------------------
@angular-devkit/architect 0.900.4
@angular-devkit/build-angular 0.900.4
@angular-devkit/build-ng-packagr 0.900.4
@angular-devkit/build-optimizer 0.900.4
@angular-devkit/build-webpack 0.900.4
@angular-devkit/core 9.0.4
@angular-devkit/schematics 9.0.4
@angular/cdk 9.1.0
@angular/material 9.1.0
@ngtools/webpack 9.0.4
@schematics/angular 9.0.4
@schematics/update 0.900.4
ng-packagr 9.0.0
rxjs 6.5.4
typescript 3.7.5
webpack 4.41.2
It's not happening with Angular 9.0.2 and Angular CLI 9.0.4. So the error is on the Angular side.
ng version where it's working:
Angular CLI: 9.0.4
Node: 12.16.1
OS: darwin x64
Angular: 9.0.2
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router, service-worker
Ivy Workspace: Yes
Package Version
------------------------------------------------------------
@angular-devkit/architect 0.900.4
@angular-devkit/build-angular 0.900.4
@angular-devkit/build-ng-packagr 0.900.4
@angular-devkit/build-optimizer 0.900.4
@angular-devkit/build-webpack 0.900.4
@angular-devkit/core 9.0.4
@angular-devkit/schematics 9.0.4
@angular/cdk 9.1.0
@angular/cli 9.0.4
@angular/material 9.1.0
@ngtools/webpack 9.0.4
@schematics/angular 9.0.4
@schematics/update 0.900.4
ng-packagr 9.0.0
rxjs 6.5.4
typescript 3.7.5
webpack 4.41.2
After upgrading to version 9.0.4 and deleting node_modules I got a lot of the following errors when running ng serve for the first time:
ERROR in Error when flattening the source-map "[path].d.ts.map" for "[path].d.ts": RangeError: Maximum call stack size exceeded
Interestingly, on the second run I got no more errors and, at a first glance, source maps seem to work (I'm not sure what this "flattening" process entails). ng build doesn't throw anymore either.
Angular CLI: 9.0.4
Node: 13.9.0
OS: linux x64
Angular: 9.0.4
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes
Package Version
------------------------------------------------------------
@angular-devkit/architect 0.900.4
@angular-devkit/build-angular 0.900.4
@angular-devkit/build-ng-packagr 0.900.4
@angular-devkit/build-optimizer 0.900.4
@angular-devkit/build-webpack 0.900.4
@angular-devkit/core 9.0.4
@angular-devkit/schematics 9.0.4
@angular/cdk 9.1.0
@ngtools/webpack 9.0.4
@schematics/angular 9.0.4
@schematics/update 0.900.4
ng-packagr 9.0.2
rxjs 6.5.4
typescript 3.7.5
webpack 4.41.2
@nunocastromartins - could you open an issue about the source-map flattening on the angular/angular repo and post some examples of the errors you saw?
It seems to be an Angular issue. I had a simliar issue after running npm run build, and I downgrade the following packages to their previous version:
@angular/cli from version 9.0.3 to 9.0.2
@anguar/compiler-cli from version 9.0.3 to 9.0.2
and everthing start working again.
@petebacondarwin, I am now consistently getting the error during build and serve. I opened https://github.com/angular/angular/issues/35757 to track it.
@nunocastromartins mentioned in his other issue that he had to delete his dist directory. When I deleted my dist and node_modules directories then npm ci and ng serve/build, everything is working now.
Angular 9.0.4, removed node_modules as suggested above, and all the stuff with it, nope that does not fix it, the only thing that lets the build proceed is if I turn off optimizationin angular.json. What would be the issue? knowing that I used the same settings for Angular 8 project and the bundle size was _larger than 500 KB_, yet nothing broke, so why would the new cli break the terser?
ng build without arguments should remove the dist folder before build as default. This seems to be broken.
--deleteOutputPath=true\|false | Delete the output path before building.Default:Β true
Looks like a terser bug, the version included in the last update is buggy, I did not try to upgrade to 4.6.4 but i downgraded to 4.1.4 and now it's working again...
@ayyash how did you pin terser to 4.1.4? That version is from 7 months ago and an invalid version for terser-webpack-plugin.
@filipesilva I really should be upgrading and making sure the latest is in, but a stab in the dark (because I was losing patience) I just copied the terser folder from another working project :) now i'm going to see if the 4.6.4 works
as a WORKAROUND
npm i terser@latest solved the issue for me.
Installed the "terser": "^4.6.4",
Angular CLI: 9.0.4
Node: 10.16.2
OS: linux x64
Angular: 9.0.4
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker
Ivy Workspace: Yes
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.900.4
@angular-devkit/build-angular 0.900.4
@angular-devkit/build-optimizer 0.900.4
@angular-devkit/build-webpack 0.900.4
@angular-devkit/core 9.0.4
@angular-devkit/schematics 9.0.4
@angular/cdk 9.1.0
@angular/flex-layout 9.0.0-beta.29
@angular/material 9.1.0
@ngtools/webpack 9.0.4
@schematics/angular 9.0.4
@schematics/update 0.900.4
rxjs 6.5.4
typescript 3.7.5
webpack 4.41.2
I had the same problem upgrading from 9.0.1 to 9.0.5, but it only happened in the first build in each server (including CI server). After the second one, everything seems all good.
In my case, it happens only once, too. When I retry building again, it works without any problem, even if I haven't done anything. That's why, some of these solutions may be misleading. π€
@soysal I had the same experience. Had the error, came here, read what you said and tried again and haven't had the error since.
I had the error, initially appeared as a pipeline error. I upgraded Angular from 9.0.3 to 9.0.7, ran ng serve and the error popped out again but the app was working fine. After reading some of the issues comment, deleting node_modules and re-installing it worked for me and the pipeline ran smoothly. Looks like it is working for now.
In case anyone is still having an issue after trying to delete node_modules, I suggest trying to play around with those values in angular.json
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
]
Something tells me it is related to either optimization turned on or the maximumError allocated space is too low (specially if you are running ng serve as dev)
I've just created a new site from scratch on angular 9, and got this error, installed terser@latest, error gone, so it is confirmed on my side that the terser library required by server-platform is the buggy element.
I got this error as soon as I created a pipe in my project. The app is using angular 9.0.4. When I removed implement PipeTransform from the pipe, the error disappeared but now lint is complaining i should implement the interface. But luckily I no longer need the pipe, so I will delete it and no prob. I was also using domSanitizer in the tranform method.
I had to reorganize some of my index.ts which were exposed in public-api.ts of my lib.
I had this error as well but in slightly different circumstances:
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ β³ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 9.1.0
Node: 10.19.0
OS: win32 x64
Angular: 9.1.0
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes
Package Version
------------------------------------------------------------
@angular-devkit/architect 0.901.0
@angular-devkit/build-angular 0.901.0
@angular-devkit/build-ng-packagr 0.901.0
@angular-devkit/build-optimizer 0.901.0
@angular-devkit/build-webpack 0.901.0
@angular-devkit/core 9.1.0
@angular-devkit/schematics 9.1.0
@ngtools/webpack 9.1.0
@schematics/angular 9.1.0
@schematics/update 0.901.0
ng-packagr 9.0.0
rxjs 6.5.5
typescript 3.7.5
webpack 4.39.2
I was trying to build a prod library, this has to have ivy turned off. A library build with Ivy was fine. I tried all the various fixes listed here but nothing helped.
In the end I discovered that barrel files broke it for me.
This code worked fine:
// public-api.ts
export * from './my-module.module';
export * from './constants/constants';
(constants just exports 2 strings)
This code fails:
// public-api.ts
export * from './my-module.module';
export * from './constants';
(exports an index.ts file that just exports * from constants)
The workaround I found was to directly export every file in public.api and avoid barrels. The npm lib barrelsby helped a lot with this:
barrelsby -e .spec.ts -D true -l top -n public.api
The possible reasons for the issues are
@NgModule({
imports: [
TestModule
],
declarations: [],
exports: []
})
export class TestModule { }
The answer of @kalimulhaq helps me, in my case, I was exporting my own module :/
@NgModule({
declarations: [
MyComponent
],
imports: [
CommonModule
],
exports: [
MyModule, <---- My problem
]
})
export class MyModule { }
Another possible reason is something like this:
export function max(values) {
return max(_.compact(values)); // Calling itself instead of _.max
}
Seta no angular.json "aot": false,
Seta no angular.json "aot": false,
Funcionou para mim. Obrigado!
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
The possible reasons for the issues are