angular: Angular 9.0.3 ngcc fails to process ng2-dragula
🐞 bug report
Affected Package
Is this a regression?
Yes it works properly with angular 9.0.2
Description
ngcc build failed with ng2-dragula.
🔬 Minimal Reproduction
- Clone https://github.com/log2-hwan/ngcc-ng2-dragula-bug-demo
npm install
npm run build ngcc-ng2-dragula-bug-demo
- Build failed with error
🔥 Exception or Error
0% compiling
Compiling @angular/core : es2015 as esm2015
Compiling @angular/common : es2015 as esm2015
Compiling @angular/platform-browser : es2015 as esm2015
Compiling @angular/platform-browser-dynamic : es2015 as esm2015
Compiling ng2-dragula : es2015 as esm2015
ERROR in Cannot read property 'push' of undefined
🌍 Your Environment
Angular Version:
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 9.0.3
Node: 13.8.0
OS: darwin x64
Angular: 9.0.3
... 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.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
@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? I guess the error is caused by commit df816c9 which is related to sourcemap processing, so ng2-dragula’s sourcemap may have some problems.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 5
- Comments: 40 (17 by maintainers)
Commits related to this issue
- fix(ngcc): handle missing sources when flattening source-maps If a package has a source-map but it does not provide the actual content of the sources, then the source-map flattening was crashing. No... — committed to petebacondarwin/angular by petebacondarwin 4 years ago
- fix(ngcc): handle missing sources when flattening source-maps If a package has a source-map but it does not provide the actual content of the sources, then the source-map flattening was crashing. No... — committed to petebacondarwin/angular by petebacondarwin 4 years ago
- fix(ngcc): handle mappings outside the content when flattening source-maps Previously when rendering flattened source-maps, it was assumed that no mapping would come from a line that is outside the l... — committed to petebacondarwin/angular by petebacondarwin 4 years ago
- fix(ngcc): handle missing sources when flattening source-maps If a package has a source-map but it does not provide the actual content of the sources, then the source-map flattening was crashing. No... — committed to petebacondarwin/angular by petebacondarwin 4 years ago
- fix(ngcc): handle mappings outside the content when flattening source-maps Previously when rendering flattened source-maps, it was assumed that no mapping would come from a line that is outside the l... — committed to petebacondarwin/angular by petebacondarwin 4 years ago
- fix(ngcc): handle missing sources when flattening source-maps (#35718) If a package has a source-map but it does not provide the actual content of the sources, then the source-map flattening was cras... — committed to angular/angular by petebacondarwin 4 years ago
- fix(ngcc): handle mappings outside the content when flattening source-maps (#35718) Previously when rendering flattened source-maps, it was assumed that no mapping would come from a line that is outs... — committed to angular/angular by petebacondarwin 4 years ago
- fix(ngcc): handle mappings outside the content when flattening source-maps (#35718) Previously when rendering flattened source-maps, it was assumed that no mapping would come from a line that is outs... — committed to angular/angular by petebacondarwin 4 years ago
I had same error and tried many different solution. Finally I’ve solved it with adding following lines to
tsconfig.app.json.
Basically, it will be solved when you disable the “Ivy” on angularCompilerOptions.
Angular 9.0.4 has been released which should fix these problems.
The proper solution was given above. Liking your own advice doesn’t increase its weight. Disabling Ivy is not the way to go. Just downgrade the Angular Version to yesterday’s.
Added a new commit to my PR that should also fix the
Cannot read property 'push' of undefined
error.I believe that the third error that was reported
RangeError: Maximum call stack size exceeded
was transient and fixed by cleaning thenode_modules
folder and re-installing.@petebacondarwin Just so you know, your commits does fix my issue.
I have an error
ERROR in Cannot read property 'flattenedMappings' of null
, seems to me this is related@tomgruszowski - we hear you.
The PR is just about green and should be merged in the next hour. The plan is to then roll out a new patch release. So you should be unblocked before the end of the day.
Sorry that this release caused some issues and frustration.
Also fails on ngx-toastr apparently:
Worked with previous version
I am also getting this error since upgrading to Angular 9.0.3
Cannot read property 'flattenedMappings' of null
. It seems to be whenngcc
runs on third party libraries. In my case I am not using either of the two libraries mentioned in the preceding comments (failing point for me is during compilation ofangular-safeguard
toesm5
)@naveedahmed1 There has not been a hot-patch for the 9.1.0-next release line, it was only 9.0.4 that was released the same week as 9.0.3. There will be a 9.1.0-next release around Wednesday/Thursday this week that should address the crash.
This seems like a pretty bad regression to wait this long, unless ‘revert to old version’ is acceptable.
*edit - thanks for the quick turnaround ng team 😃
At a minimum you need to change
@angular/compiler-cli
from “~9.0.3” to “9.0.2”. But to be on the safe side you could change all the~9.0.3
to9.0.2
and also the~0.900.3
to0.900.2
.I had trouble with ngcc when compiling
@angular/animations
.I don’t know if you guys will have success with this, but the issue went away when deleting
node_modules
andpackage-lock.json
and reinstalling everything from scratch.Nope it didn’t… worse happened for me after updating to 9.0.4 from 9.0.2…
had to rollback my package* files and had to delete node_modules and run
npm install
to reinstall Just rolling back package* files and runningnpm install
didn’t work that is why I had to delete node_modulesThe normal cycle is to release a new patch version every week. Given that 9.0.3 came out yesterday, I expect 9.0.4 to be released next Wednesday 4th March.
There seemed to be a problem again so I did it all over again and it looks better. Thanks @petebacondarwin and @Ploppy3
@GitHubish - did you change the package.json dependencies to 9.0.2 before removing
node_modules
and runningnpm i
?Here it works after deleting node_modules and running npm i again.
I’m using angular 9.0.3
@GitHubish Remove the node_modules folder & your package manager’s lock file and finally run the
install
command again