question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running ngcc in postinstall. Angular CLI should not run as part of the build step

See original GitHub issue

🐞 bug report / feature request

This issue is a follow up to https://github.com/angular/angular/issues/35000

Affected Package

@angular/compiler-cli

Is this a regression?

Maybe - https://github.com/angular/angular/issues/35000

Description

The advice in https://github.com/angular/angular/issues/35000#issuecomment-579123805 from @Toxicable was to set up a postinstall hook like so:

If you run ngcc yourself beforehand then the angular cli wont run it as part of it’s build step. That should solve you issue of building multiple apps in parallel

"postinstall": "ngcc  --create-ivy-entry-points --properties es2015 browser module main",

the angular cli wont run it as part of it’s build step. <- this is the key part I would expect to happen but it doesn’t seem to be the case. as I see ngcc being run in my build for every webpack build

Another process, with id 44, is currently running ngcc.
--
5 | Waiting up to 25s for it to finish.
6 | Another process, with id 124, is currently running ngcc.
7 | Waiting up to 25s for it to finish.
8 | Another process, with id 44, is currently running ngcc.
9 | Waiting up to 25s for it to finish.
10 | Another process, with id 117, is currently running ngcc.
11 | Waiting up to 25s for it to finish.
12 | Another process, with id 58, is currently running ngcc.
13 | Waiting up to 25s for it to finish.
14 | Another process, with id 44, is currently running ngcc.
15 | Waiting up to 25s for it to finish.

Unfortunately when CI is busy with other work the max retries is used up and the build fails. We have about 10 parallel builds of different flavors of our Angular App so there is A LOT of parallelism going on.

Would it be possible to disable NGCC in ngtools/webpack builds when the dependencies have already been compiled before? @Toxicable @petebacondarwin @AndrewKushnir @gkalpak

🌍 Your Environment

Angular Version: Angular: 9.1.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Rushcommented, Jul 24, 2020

@gkalpak Please see this repo for a reproducible test case https://github.com/Rush/ngcc-issue-repro/blob/master/README.md

> npm install
## RUNS ngcc  --create-ivy-entry-points --properties es2015 browser module main

> ./start-builds.sh 

> ngcc-issue-repro@0.0.0 build5 /home/rush/code/angular-bug/ngcc-issue-repro
> BUILD_NAME=build1 webpack


> ngcc-issue-repro@0.0.0 build2 /home/rush/code/angular-bug/ngcc-issue-repro
> BUILD_NAME=build1 webpack


> ngcc-issue-repro@0.0.0 build3 /home/rush/code/angular-bug/ngcc-issue-repro
> BUILD_NAME=build1 webpack


> ngcc-issue-repro@0.0.0 build1 /home/rush/code/angular-bug/ngcc-issue-repro
> BUILD_NAME=build1 webpack


> ngcc-issue-repro@0.0.0 build4 /home/rush/code/angular-bug/ngcc-issue-repro
> BUILD_NAME=build1 webpack

Another process, with id 31479, is currently running ngcc.
Waiting up to 250s for it to finish.
Another process, with id 31479, is currently running ngcc.
Waiting up to 250s for it to finish.
Another process, with id 31479, is currently running ngcc.
Waiting up to 250s for it to finish.
Another process, with id 31479, is currently running ngcc.
Waiting up to 250s for it to finish.
Another process, with id 31472, is currently running ngcc.
Waiting up to 250s for it to finish.
Another process, with id 31472, is currently running ngcc.
Waiting up to 250s for it to finish.
Another process, with id 31472, is currently running ngcc.
Waiting up to 250s for it to finish.
Another process, with id 31458, is currently running ngcc.
Waiting up to 250s for it to finish.
Another process, with id 31458, is currently running ngcc.
Waiting up to 250s for it to finish.
Another process, with id 31451, is currently running ngcc.
Waiting up to 250s for it to finish

Please let me know if you have any questions or need additional clarity.

0reactions
angular-automatic-lock-bot[bot]commented, Oct 2, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 11 is not running ngcc - ivy - Stack Overflow
I thought that as we are using Ivy, running it will be part of the build by default. I was able to run...
Read more >
Angular 9: ngcc in postinstall script... : r/Angular2 - Reddit
I just finished upgrading from Angular 8 to Angular 9. The upgrade guide recommended the following step: If you depend on many Angular...
Read more >
Hi I am running into th… - @Nrwl/Community
Hi, I am running into this problem: https://github.com/angular/angular-cli/issues/17110: my tests (jest) are still using ViewEngine.
Read more >
error: failed to initialize angular compilation - ngcc failed.
Try to find node_modules/@angular/compiler-cli/ngcc/ngcc_lock_file file and delete it. Or Just delete your node_modules folder and do npm install. Open side ...
Read more >
Getting Started with Monorepo with Nx Nrwl - Rupesh Tiwari
Creating JS project using NX Console; How to create Run Command in NX Monorepo; Step: Create Angular App using Nx Console; Adding Nx...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found