Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation breaks after update to 9.0.0-rc.13: Duplicate identifier 'ɵngcc0' #35095

Closed
cyrilletuzi opened this issue Feb 1, 2020 · 4 comments
Assignees
Labels
regression Indicates than the issue relates to something that worked in a previous version type: bug/fix
Milestone

Comments

@cyrilletuzi
Copy link
Contributor

cyrilletuzi commented Feb 1, 2020

🐞 bug report

Affected Package

I think the issue is in @angular/compiler-cli as it's about ngcc, but not sure.

Is this a regression?

Yes, it was OK in previous RC (rc.12 and below).

Reproduction

  • npm install @angular/cli@next -g
  • ng new helloworld --skipGit (git is disabled to avoid ng commands blocking because repo is not clean, otherwise you have to commit every change)
  • cd helloworld
  • npm install @angular/{animations,common,compiler,core,forms,platform-browser,platform-browser-dynamic,router,compiler-cli,language-service}@9.0.0-rc.12 (rollback to rc.12, as CLI installed rc.13)
  • add any library, for example: ng add @angular/material@next and add MatCardModule in AppModule imports
  • npm start (to run the compilation with rc.12)
  • ng update @angular/core --next (will update to rc.13)
  • npm start

🔥 Exception or Error

Compilation breaks with a lot of errors like this one (it's just an example):


import * as ɵngcc0 from '@angular/core';
                   ~~~~~~
    node_modules/@angular/material/core/selection/pseudo-checkbox/pseudo-checkbox.d.ts:13:13 -
error TS2300: Duplicate identifier 'ɵngcc0'.

🌍 Your Environment

Angular Version:


Angular CLI: 9.0.0-rc.12
Node: 12.14.1
OS: darwin x64

Angular: 9.0.0-rc.13
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.900.0-rc.12
@angular-devkit/build-angular     0.900.0-rc.12
@angular-devkit/build-optimizer   0.900.0-rc.12
@angular-devkit/build-webpack     0.900.0-rc.12
@angular-devkit/core              9.0.0-rc.12
@angular-devkit/schematics        9.0.0-rc.12
@angular/cdk                      9.0.0-rc.9
@angular/cli                      9.0.0-rc.12
@angular/material                 9.0.0-rc.9
@ngtools/webpack                  9.0.0-rc.12
@schematics/angular               9.0.0-rc.12
@schematics/update                0.900.0-rc.12
rxjs                              6.5.4
typescript                        3.7.5
webpack                           4.41.2

Anything else relevant?
Quite sure the issue comes from #35079. Before rc.13, when ng updating, next compilation would be blocked, asking to clean up node_moddules (#35082).

With rc.13, compilation is not blocked anymore, Angular do a new ngcc compilation (Compiling @angular/core : es2015 as esm2015), but then fails because of old artifacts. If you clean node_modules (npm ci), then compilation works again.

Also note that:

  • if you have no library at all, the issue doesn't happen,
  • it's not specific to Material, it happens with all librairies.

So I think #35079 does not clean up libraries packages.

@gkalpak gkalpak added comp: ngcc regression Indicates than the issue relates to something that worked in a previous version type: bug/fix labels Feb 1, 2020
@ngbot ngbot bot added this to the needsTriage milestone Feb 1, 2020
@gkalpak gkalpak modified the milestones: needsTriage, v9-blockers Feb 1, 2020
@IgorMinar IgorMinar pinned this issue Feb 1, 2020
IgorMinar added a commit to IgorMinar/angular that referenced this issue Feb 1, 2020
it's a bit hacky, but it should repro the issue well while keeping the shape of the integration test similar
to the other integration tests.
@IgorMinar
Copy link
Contributor

I've tried to repro this in #35101 but so far I'm not having luck.

@cyrilletuzi
Copy link
Contributor Author

Repro: https://github.com/cyrilletuzi/ngcc-cleanup

To reproduce:

git clone https://github.com/cyrilletuzi/ngcc-cleanup
cd ngcc-cleanup
npm run issue

@gkalpak gkalpak self-assigned this Feb 2, 2020
@gkalpak
Copy link
Member

gkalpak commented Feb 2, 2020

Thx for the repro, @cyrilletuzi. It really helped the to the bottom of it more quickly 💯

So, it turns out we are not invalidating our FileSystem cache correctly when moving a file or when removing a directory during clean-up. I have verified the fix against your repro - PR incoming 🚀

gkalpak added a commit to gkalpak/angular that referenced this issue Feb 2, 2020
gkalpak added a commit to gkalpak/angular that referenced this issue Feb 2, 2020
…ctories

One particular scenario where this was causing problems was when the
[BackupFileCleaner][1] restored a file (such as a `.d.ts` file) by
[moving the backup file][2] to its original location, but the modified
content was kept in the cache.

[1]: https://github.com/angular/angular/blob/4d36b2f6e/packages/compiler-cli/ngcc/src/writing/cleaning/cleaning_strategies.ts#L54
[2]: https://github.com/angular/angular/blob/4d36b2f6e/packages/compiler-cli/ngcc/src/writing/cleaning/cleaning_strategies.ts#L61

Fixes angular#35095
gkalpak added a commit to gkalpak/angular that referenced this issue Feb 2, 2020
…ctories

One particular scenario where this was causing problems was when the
[BackupFileCleaner][1] restored a file (such as a `.d.ts` file) by
[moving the backup file][2] to its original location, but the modified
content was kept in the cache.

[1]: https://github.com/angular/angular/blob/4d36b2f6e/packages/compiler-cli/ngcc/src/writing/cleaning/cleaning_strategies.ts#L54
[2]: https://github.com/angular/angular/blob/4d36b2f6e/packages/compiler-cli/ngcc/src/writing/cleaning/cleaning_strategies.ts#L61

Fixes angular#35095
gkalpak added a commit to gkalpak/angular that referenced this issue Feb 3, 2020
…ctories

One particular scenario where this was causing problems was when the
[BackupFileCleaner][1] restored a file (such as a `.d.ts` file) by
[moving the backup file][2] to its original location, but the modified
content was kept in the cache.

[1]: https://github.com/angular/angular/blob/4d36b2f6e/packages/compiler-cli/ngcc/src/writing/cleaning/cleaning_strategies.ts#L54
[2]: https://github.com/angular/angular/blob/4d36b2f6e/packages/compiler-cli/ngcc/src/writing/cleaning/cleaning_strategies.ts#L61

Fixes angular#35095
@mhevery mhevery closed this as completed in 523c785 Feb 3, 2020
mhevery pushed a commit that referenced this issue Feb 3, 2020
…ctories (#35106)

One particular scenario where this was causing problems was when the
[BackupFileCleaner][1] restored a file (such as a `.d.ts` file) by
[moving the backup file][2] to its original location, but the modified
content was kept in the cache.

[1]: https://github.com/angular/angular/blob/4d36b2f6e/packages/compiler-cli/ngcc/src/writing/cleaning/cleaning_strategies.ts#L54
[2]: https://github.com/angular/angular/blob/4d36b2f6e/packages/compiler-cli/ngcc/src/writing/cleaning/cleaning_strategies.ts#L61

Fixes #35095

PR Close #35106
@kara kara unpinned this issue Feb 4, 2020
sonukapoor pushed a commit to sonukapoor/angular that referenced this issue Feb 13, 2020
…ctories (angular#35106)

One particular scenario where this was causing problems was when the
[BackupFileCleaner][1] restored a file (such as a `.d.ts` file) by
[moving the backup file][2] to its original location, but the modified
content was kept in the cache.

[1]: https://github.com/angular/angular/blob/4d36b2f6e/packages/compiler-cli/ngcc/src/writing/cleaning/cleaning_strategies.ts#L54
[2]: https://github.com/angular/angular/blob/4d36b2f6e/packages/compiler-cli/ngcc/src/writing/cleaning/cleaning_strategies.ts#L61

Fixes angular#35095

PR Close angular#35106
sonukapoor pushed a commit to sonukapoor/angular that referenced this issue Feb 17, 2020
…ctories (angular#35106)

One particular scenario where this was causing problems was when the
[BackupFileCleaner][1] restored a file (such as a `.d.ts` file) by
[moving the backup file][2] to its original location, but the modified
content was kept in the cache.

[1]: https://github.com/angular/angular/blob/4d36b2f6e/packages/compiler-cli/ngcc/src/writing/cleaning/cleaning_strategies.ts#L54
[2]: https://github.com/angular/angular/blob/4d36b2f6e/packages/compiler-cli/ngcc/src/writing/cleaning/cleaning_strategies.ts#L61

Fixes angular#35095

PR Close angular#35106
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
regression Indicates than the issue relates to something that worked in a previous version type: bug/fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants