How to run ngcc with Angular 11/12
Asked Answered
B

1

1

So we have a monorepo that has two different projects using Angular. We also have a build pipeline to automate the integration process. The problem I'm running into is that ngcc does not support parallel execution. I want to run the ngcc command manually before the parallel process starts, but I don't see to find how?

The project is using Angular 11, and I have @angular/[email protected] installed globally, so I was expecting ngcc to be part of the tools there but no luck so far. I'm simply getting this error: -bash: ngcc: command not found

In case anyone is wondering this is the error I get if I simply try to run ng build in parallel:

ERROR in ngcc is already running at process with id 2113.
If you are running multiple builds in parallel then you might try pre-processing your node_modules via the command line ngcc tool before starting the builds.
(If you are sure no ngcc process is running then you should delete the lock-file at /Users/runner/work/1/s/frontend/apps/MY_APP/node_modules/@angular/compiler-cli/ngcc/__ngcc_lock_file__.)
Beamon answered 9/11, 2021 at 20:29 Comment(0)
P
3

Can you try: npx ngcc -s path ?

Pterous answered 9/11, 2021 at 20:52 Comment(3)
what is the -s path? I tried just npx ngcc inside one of the angular projects, but I get a 404 from the npm main registry: 404 Not Found - GET https://registry.npmjs.org/ngcc - Not foundBeamon
Stupid question: did you run npm install over angular project? In my project I can see in node_modules\.bin\ngccPterous
This was so dumb of me. I just realized that the angular project I was looking at didn't have node_modules in it. This works.Beamon

© 2022 - 2024 — McMap. All rights reserved.