angular: "Error: NGCC failed" when using `"somepackage": "file:app/somepackage"` in package.json
🐞 bug report
Affected Package
@ngtools/webpack@10.1.0 @angular/compiler@10.1.0 @angular/compiler-cli@10.1.0
Now I have version 10.1.1, but bug is still there.
Is this a regression?
Yes, the previous version in which this bug was not present was: 10.0.14
Description
I am using custom Webpack configuration as I am coming from NgUpgrade world. I am using in my work project multiple git submodules. I am linking their package.json via "somepackage": "file:app/somepackage"
format (see in my github repo package.json).
🔬 Minimal Reproduction
https://github.com/kmaraz/ngcc-failed
Just install packages via yarn
and then build project with Ivy: yarn run failsdev
.
Note: when you remove somepackage
from package.json, run yarn, then everything works as expected.
🔥 Exception or Error
100% times build just hangs, sometimes when it hangs and I terminate it, I get Error: NGCC failed.
🌍 Your Environment
Angular Version:
Angular packages in version 10.1.1
Anything else relevant? I am using Windows Subsystem for Linux.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 20 (10 by maintainers)
Oh, wow! So, based on what you said @gkalpak, I have moved my project to native WSL2 home directory and NGCC time is now down to 30seconds 😮. This is a completely different world to me now.
I am really grateful to all of you guys with helping me to debug my problem. I have learned multiple things, like debugging nodejs projects, or about filesystems and how they cooperate.
So let me thank you again!
--use-program-dependencies
will parse the imports in your project to work out what packages are actually being used. Based on that it will then determine which libraries/entry-points need processing.I note that in your tsconfig.json you are using
exclude
to specify which files to load. I suspect that the package.json/tsconfig.json in theapp/somepackage
folder is being picked up by TS as something to compile but themain
file in that package does not exist.Can you try running ngcc directly but including that
--use-program-dependencies
option. This may give a more specific error.Nope, it didn’t. Also Now I tested the second project on Window 10 via command line (no WSL, bash, etc.) and I’ve got the same error. So It must be someting related to that project. I’ll try to pinpoint by gradual uprading of the packages at least to the latest stable version and then I’ll try to compare diffs in the Angular code. Maybe I’ll come up with something more concrete.