2

I'm updating an Angular library version from v9.1.13 to v10.2.5, but getting the following error: Migration failed: Could not find any tsconfig file. Cannot add the "@Injectable" decorator to providers which don't have that decorator set.

enter image description here

I searched for Angular resources mentioned along with error: https://v9.angular.io/guide/migration-injectable, but it didn't help much as library is already following the required structure.

Similar kind of question is still unanswered on SO: Angular version update giving an error - Migration failed: Could not find any tsconfig file

If anyone has already gone through alike problem and found the solution, help will be really appreciated.

Gourav Pokharkar
  • 1,568
  • 1
  • 11
  • 33

1 Answers1

0

Did you update Angular 9 to Angular 10 like this below?

ng update @angular/core@10 @angular/cli@10 --force 

If above approach does not work try disabling Ivy engine in tsconfig.json file:

In case if you are using some outdated package which is not compatible with Ivy.

"angularCompilerOptions": {"enableIvy": false}
Salahuddin Ahmed
  • 4,854
  • 4
  • 14
  • 35
  • I'm updating a specific library (`ng2-dnd`) which wasn't supporting ivy. I could update it to v9 with `"angularCompilerOptions": { compilationMode: "partial" }` as recommended by Angular. I just got issue as `NG2003: No suitable injection token for parameter`, so I followed `https://angular.io/errors/NG2003#debugging-the-error` link. It got resolved after I added `@Inject()` for constructor parameters and library is also working fine. – Gourav Pokharkar Sep 21 '21 at 03:00
  • Current problem is just with migration from v9 to v10 as mentioned in question below. I'm getting issue in `ng update` step only, so it doesn't have anything to do with `compilationMode` or `enableIvy` at the time of migration. It's failing at migration and also error is not pointing out the code where the issue lies. – Gourav Pokharkar Sep 21 '21 at 03:02