1

We are migrating our project to angular 12 and primeng 12, but we are stuck in this error that repeat it many times. We looked at other similar questions but couldn´t resolve with any of the solutions proposed on the answers.

When do ng build it shows this error:

Error: src/app/app-shared.module.ts:117:14 - error NG6002: Appears in the NgModule.imports of AppModule, but itself has errors

export class AppSharedModule {}

and is followed by many repeated errors in the same location.

enter image description here

We already tried many solutions like do ng server, deactivate Ivy, but none of them solved.

Is there any solution for this? Thanks!

Rômulo Sorato
  • 1,570
  • 5
  • 18
  • 29

2 Answers2

1

To answer the question, we came to a conclusion that we made a mistake trying to migrate our project from angular 10 to 12 and prime ng 9 to 12.

When migrating an angular project, is not recomended upgrade multiple versions at the same time

As angular recomends in https://angular.io/guide/updating

So,now will make the migration step by step, first preparing the application, by removing all warnings and deprecated, and then migrating one version at a time.

Thanks!

Edit: After restart migration this error appears aggain after set "enableIvy": true as one of our modules is not compatible with ivy, setting to false solve the problem

Rômulo Sorato
  • 1,570
  • 5
  • 18
  • 29
  • i just tried to put the phrase on red alert style but i dont know to make it ;( – Rômulo Sorato Sep 24 '21 at 00:21
  • Also doing `rm -rf node_modules package-lock.json ; npm install ;` between every `ng update` call helps with some issues during such update spree. – Mikhail Orlov Oct 20 '21 at 15:14
  • what this command does? Here we used to delete node modules package.lock and do npm install again, to clean and restart project – Rômulo Sorato Oct 20 '21 at 20:24
  • 1
    Exactly that. My point is that outcome of consequtive `ng update` when going 9-10-11-12 is different if you don't reinstall from scratch between versions. – Mikhail Orlov Oct 22 '21 at 12:00
1

Had this problem because one of the modules had a bundled package files inside. Had to remove it and add a proper package.json reference.

Mikhail Orlov
  • 2,789
  • 2
  • 28
  • 38