how to fix Error: export 'ɵsupportsWebAnimations'

Viewed 2841

im trying to replicate this component:

stackblitz.com/edit/angular-material-star-rating?file=package.json

however, on my project im unable to run it due to the following errors:

./node_modules/@angular/platform-browser/fesm2015/animations.mjs:533:9-31 - Error: export 'ɵsupportsWebAnimations' (imported as 'ɵsupportsWebAnimations') was not found in '@angular/animations/browser' (possible exports: AnimationDriver, ɵAnimation, ɵAnimationEngine, ɵAnimationStyleNormalizer, ɵNoopAnimationDriver, ɵNoopAnimationStyleNormalizer, ɵWebAnimationsDriver, ɵWebAnimationsPlayer, ɵWebAnimationsStyleNormalizer, ɵallowPreviousPlayerStylesMerge, ɵcontainsElement, ɵinvokeQuery, ɵvalidateStyleProperty)

./node_modules/@angular/platform-browser/fesm2015/animations.mjs:533:69-88 - Error: export 'ɵCssKeyframesDriver' (imported as 'ɵCssKeyframesDriver') was not found in '@angular/animations/browser' (possible exports: AnimationDriver, ɵAnimation, ɵAnimationEngine, ɵAnimationStyleNormalizer, ɵNoopAnimationDriver, ɵNoopAnimationStyleNormalizer, ɵWebAnimationsDriver, ɵWebAnimationsPlayer, ɵWebAnimationsStyleNormalizer, ɵallowPreviousPlayerStylesMerge, ɵcontainsElement, ɵinvokeQuery, ɵvalidateStyleProperty)

i have already did the

npm install --save @angular/material @angular/cdk @angular/animations --force
2 Answers

If you already had a package.json file in your project all you needed to do is run:

  1. npm i to install all the declared dependencies on the project
  2. npm run serve to serve your Angular application.

I can also see that project is quite old (Angular 5, we're currently on Angular 13) so perhaps you'll need to migrate some code to the current version you're using

I changed @angular/animations version and I solved this problem.

on package.json,

"@angular/animations": "13.0.1",
"@angular/cdk": "13.0.1",
"@angular/common": "13.0.1",
"@angular/compiler": "13.0.1",
"@angular/core": "13.0.1",
"@angular/forms": "13.0.1",
"@angular/language-service": "13.0.1",
"@angular/platform-browser": "13.0.1",
"@angular/platform-browser-dynamic": "13.0.1",
"@angular/router": "13.0.1",

When @angular/animations version is 13.2.3 (latest), same problem has occurred. Fix your version same with angular version.

Related