简体   繁体   中英

Update Angular 7 to Angular 8

This is my package.json

"@agm/core": "^1.1.0",
"@angular/animations": "^8.2.14",
"@angular/cdk": "^6.4.7",
"@angular/common": "^8.0.0",
"@angular/compiler": "^8.2.14",
"@angular/core": "^8.2.14",
"@angular/forms": "^8.2.14",
"@angular/material": "^8.2.3",
"@angular/platform-browser": "^8.2.14",
"@angular/platform-browser-dynamic": "^8.2.14",
"@angular/router": "^8.2.14",

I did all the steps to update my project from angular 7 to 8, but it generates the following error when executing ng serve:

ERROR in ../node_modules/@angular/material/stepper/typings/step-header.d.ts:13:10 - error 
TS2305: Module '"../../../cdk/stepper"' has no exported member 'CdkStepHeader'.

13 import { CdkStepHeader, StepState } from '@angular/cdk/stepper';
        ~~~~~~~~~~~~~
../node_modules/@angular/material/stepper/typings/step-header.d.ts:13:25 - error TS2305: 
Module '"../../../cdk/stepper"' has no exported member 'StepState'.

13 import { CdkStepHeader, StepState } from '@angular/cdk/stepper';
                       ~~~~~~~~~
../node_modules/@angular/material/stepper/typings/stepper-icon.d.ts:9:10 - error TS2305: 
Module '"../../../cdk/stepper"' has no exported member 'StepState'.

This is my angular configuration.

Angular CLI: 8.3.21
Node: 10.16.3
Angular: 8.2.14

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.21
@angular-devkit/build-angular     0.803.21
@angular-devkit/build-optimizer   0.803.21
@angular-devkit/build-webpack     0.803.21
@angular-devkit/core              8.3.21
@angular-devkit/schematics        8.3.21
@angular/cdk                      6.4.7
@angular/cli                      8.3.21
@angular/material                 8.2.3
@ngtools/webpack                  8.3.21
@schematics/angular               8.3.21
@schematics/update                0.803.21
rxjs                              6.5.3
typescript                        3.5.3
webpack                           4.39.2

I already searched the web and found these answers but they don't work for me

information

This is the command that should solve the problem, as I understand @ angular / material @ angular / cdk and angular should be in the latest version

    npm install --save @ angular / material @ angular / cdk

I appreciate your collaboration to solve this, thank you very much :)

Please update your @angular/cdk and @angular/common to the version ^8.2.14 .

You just need to change those versions in the package.json dependency.

To make sure that everything works like expected I recommend the following order:

  1. Go into your package.json
  2. Replace every @angular dependency version to a consistent version number. Here you can find what feature you can expect from which version: https://github.com/angular/angular/blob/master/CHANGELOG.md
  3. Remove your node_modules/ folder
  4. Reinstall your dependencies with npm install for npm or yarn install for yarn

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM