I recently updated my Angular app from version 8 to version 9. After resolving all compilation and linter errors, I encountered one specific issue that is causing me trouble:
ERROR in The target entry-point "@angular/cdk/platform" has missing dependencies:
@angular/core
@angular/common
Here are the angular packages listed in my package.json file:
"@angular/animations": "10.0.12",
"@angular/cdk": "10.1.3",
"@angular/common": "10.0.12",
"@angular/compiler": "10.0.12",
"@angular/core": "10.0.12",
"@angular/flex-layout": "10.0.0-beta.32",
"@angular/forms": "10.0.12",
"@angular/material": "10.1.3",
"@angular/platform-browser": "10.0.12",
"@angular/platform-browser-dynamic": "10.0.12",
"@angular/router": "10.0.12",
I have already tried numerous solutions like removing node_modules, package-lock.json, and re-installing dependencies.
Although I suspected the error might be related to the ivy compiler, it seems to be compiling everything correctly:
> ngcc --tsconfig './src/tsconfig.app.json' && bash post-install-checks.sh
Compiling @angular/cdk/platform : fesm2015 as esm2015
(and others)
What could possibly be causing this particular error? Am I overlooking something important?
Furthermore, I have also come across additional errors during my troubleshooting process:
/myDevFolder/my-app/node_modules/@types/d3-shape/index.d.ts
Error:(2273, 19) TS2304: Cannot find name 'CanvasPathMethods'.
(myDevFolder/my-app/node_modules/protractor/built/index.d.ts
Error:(5, 10) TS2440: Import declaration conflicts with local declaration of 'PluginConfig'.
Error:(5, 24) TS2440: Import declaration conflicts with local declaration of 'ProtractorPlugin'.
...
Additional Information
Upon rerunning the migrations for ng update, a new error was identified:
❯ Undecorated classes with DI migration.
As of Angular 9, it is no longer supported to use Angular DI on a class that does not have an Angular decorator.
Read more about this here: https://v9.angular.io/guide/migration-undecorated-classes
Failed to read JSON file /myDevFolder/dev/node_modules/@angular/material/typings/core/index.metadata.json
This migration uses the Angular compiler internally and therefore projects that no longer build successfully after the update cannot run the migration. Please ensure there are no AOT compilation errors and rerun the migration. The following project failed: src/tsconfig.app.json
Error: Path "/../node_modules/@angular/material/typings/core/index.metadata.json" is invalid.
Could not migrate all undecorated classes that use dependency
injection. Some project targets could not be analyzed due to
TypeScript program failures.