Search code examples
angularangular-cliangular11angular12

How to run ngcc with Angular 11/12


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__.)

Solution

  • Can you try: npx ngcc -s path ?