I have an Angular app that was version 8. I updated to 9. I have resolved all compilation and linter errors, except for one that is giving me some problems:
ERROR in The target entry-point "@angular/cdk/platform" has missing dependencies:
@angular/core
@angular/common
These are the angular packages in my package.json:
"@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 tried removing node_modules, package-lock.json, re-installing, etc.
I thought this might have to do with the ivy compiler, but it is compiling everything (I think):
> ngcc --tsconfig './src/tsconfig.app.json' && bash post-install-checks.sh
Compiling @angular/cdk/platform : fesm2015 as esm2015
(and others)
What can cause this type of error? What am I missing?
Here are some more errors I found:
/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'.
/myDevFolder/node_modules/@angular/cdk/a11y/typings/aria-describer/aria-describer.d.ts
Error:(8, 53) TS2307: Cannot find module '@angular/core'.
/myDevFolder/node_modules/@angular/cdk/a11y/typings/focus-monitor/focus-monitor.d.ts
Error:(9, 71) TS2307: Cannot find module '@angular/core'.
Error:(10, 28) TS2307: Cannot find module 'rxjs'.
/myDevFolder/node_modules/@angular/cdk/a11y/typings/focus-trap/focus-trap.d.ts
Error:(8, 74) TS2307: Cannot find module '@angular/core'.
/myDevFolder/node_modules/@angular/cdk/a11y/typings/key-manager/list-key-manager.d.ts
Error:(8, 27) TS2307: Cannot find module '@angular/core'.
Error:(9, 25) TS2307: Cannot find module 'rxjs'.
/myDevFolder/node_modules/@angular/cdk/a11y/typings/live-announcer/live-announcer-tokens.d.ts
Error:(8, 32) TS2307: Cannot find module '@angular/core'.
/myDevFolder/node_modules/@angular/cdk/a11y/typings/live-announcer/live-announcer.d.ts
Error:(9, 57) TS2307: Cannot find module '@angular/core'.
/myDevFolder/node_modules/@angular/cdk/observers/typings/observe-content.d.ts
Error:(8, 79) TS2307: Cannot find module '@angular/core'.
Error:(9, 28) TS2307: Cannot find module 'rxjs'.
/myDevFolder/node_modules/@angular/material/typings/core/common-behaviors/color.d.ts
Error:(9, 28) TS2307: Cannot find module '@angular/core'.
/myDevFolder/node_modules/@angular/material/typings/core/common-behaviors/common-module.d.ts
Error:(8, 32) TS2307: Cannot find module '@angular/core'.
Error:(9, 30) TS2307: Cannot find module '@angular/platform-browser'.
/myDevFolder/node_modules/@angular/material/typings/core/common-behaviors/error-state.d.ts
Error:(8, 55) TS2307: Cannot find module '@angular/forms'.
Error:(9, 25) TS2307: Cannot find module 'rxjs'.
/myDevFolder/node_modules/@angular/material/typings/core/common-behaviors/initialized.d.ts
Error:(8, 28) TS2307: Cannot find module 'rxjs'.
/myDevFolder/node_modules/@angular/material/typings/core/datetime/date-adapter.d.ts
Error:(8, 32) TS2307: Cannot find module '@angular/core'.
Error:(9, 37) TS2307: Cannot find module 'rxjs'.
/myDevFolder/node_modules/@angular/material/typings/core/datetime/date-formats.d.ts
Error:(8, 32) TS2307: Cannot find module '@angular/core'.
/myDevFolder/node_modules/@angular/material/typings/core/error/error-options.d.ts
Error:(8, 57) TS2307: Cannot find module '@angular/forms'.
/myDevFolder/node_modules/@angular/material/typings/core/gestures/gesture-config.d.ts
Error:(8, 32) TS2307: Cannot find module '@angular/core'.
Error:(9, 37) TS2307: Cannot find module '@angular/platform-browser'.
/myDevFolder/node_modules/@angular/material/typings/core/label/label-options.d.ts
Error:(8, 32) TS2307: Cannot find module '@angular/core'.
/myDevFolder/node_modules/@angular/material/typings/core/line/line.d.ts
Error:(8, 39) TS2307: Cannot find module '@angular/core'.
/myDevFolder/node_modules/@angular/material/typings/core/option/option.d.ts
Error:(8, 117) TS2307: Cannot find module '@angular/core'.
Error:(10, 25) TS2307: Cannot find module 'rxjs'.
/myDevFolder/node_modules/@angular/material/typings/core/ripple/ripple-renderer.d.ts
Error:(8, 36) TS2307: Cannot find module '@angular/core'.
/myDevFolder/node_modules/@angular/material/typings/core/ripple/ripple.d.ts
Error:(9, 71) TS2307: Cannot find module '@angular/core'.
/myDevFolder/node_modules/@angular/material/typings/core/version.d.ts
Error:(8, 25) TS2307: Cannot find module '@angular/core'.
I reran the migrations for ng update, and an error appeared this time:
❯ 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.
I found the solution to my problem here: Missing material dependencies after upgrade to Angular 9. Maybe it's can help you. Basically it is: