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.

ngcc clashes with pnpm

See original GitHub issue

When using pnpm as a package manager, ng build (or serve) causes application errors on the first run. Running ng build (or serve) a second time fixes the issues.

This process can cause a few different types of application errors, it is hard to pin down. Check the repro for a reproduction of Cannot read property 'bindingStartIndex' of null error.

Other errors caused:

  • Does not have ‘ɵmod’ property (application)
  • Tried to overwrite (…)__ivy_ngcc_bak with an ngcc back up file, which is disallowed (build)

I suspect this is because ngcc manipulates the node_modules folder in a way that is incompatible with pnpm.

Suggestions:

  • keep node_modules readonly.
  • custom location for ngcc output (would be great for CI pipeline build caching).

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
JoostKcommented, Aug 25, 2021

Heya, using pnpm is not supported (see #32087) and I’m somewhat surprised that it even works to some extend.

ngcc exists to bridge the gap between ViewEngine libraries and Ivy’s compilation output. We are working towards making the core packages be published in native Ivy format starting from v13 and there are no plans to revisit how ngcc works to make it compatible with tools like pnpm (and Yarn P’n’P etc.) per Alex’s comment in https://github.com/angular/angular/issues/32087#issuecomment-523225437.

0reactions
angular-automatic-lock-bot[bot]commented, Sep 26, 2021

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

pnpm postinstall ngcc doesn't run as should - Stack Overflow
The console output shows that the postinstall script gets executed, but then the pnpm install process finishes without executing ngcc.
Read more >
pnpm/pnpm - Gitter
I have multiple libraries and got this problem of running postinstall (cmd: ngcc) as part of an upgrade to angular v9. unfortunately it's...
Read more >
Problem with NGCC - David Votrubec
NGCC stands for Angular Compatibility Compiler, which recompiles various ... Error: Tried to overwrite /opt/rb3/node_modules/.pnpm/@angular+ ...
Read more >
The year 2021 for pnpm
It is the end of the year and it was a good year for pnpm, so let's see how it went.
Read more >
The Angular linker (goodbye ngcc!) - Ninja Squad
Angular 11.1 introduced a new compilation mode. It allows to partially compile a library before shipping it to NPM. What does that mean?...
Read more >

github_iconTop Related Medium Post

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