简体   繁体   English

Angular 4:“在'@ angular / animations'中找不到导出'AnimationBuilder'

[英]Angular 4 : "export 'AnimationBuilder' was not found in '@angular/animations'

I was using these versions 我正在使用这些版本

 "dependencies": { "@angular/animations": "^5.0.0", "@angular/common": "^4.0.0", "@angular/compiler": "^4.0.0", "@angular/core": "^4.0.0", "@angular/forms": "^4.0.0", "@angular/http": "^4.0.0", "@angular/platform-browser": "^4.0.0", "@angular/platform-browser-dynamic": "^4.0.0", "@angular/router": "^4.0.0", "archiver": "^2.1.0", "body-parser": "^1.18.2", "core-js": "^2.4.1", "cors": "^2.8.4", "express": "^4.16.2", "file-saver": "^1.3.3", "rxjs": "^5.1.0", "zone.js": "^0.8.4" }, 

And my application was working perfect. 而且我的应用程序运行完美。

I tried compile it using ng build --prod --aot and got this error : 我尝试使用ng build --prod --aot编译它,并收到此错误:

ERROR in Metadata version mismatch for module 元数据版本不匹配的模块错误

and by referring this answer I downgraded @angular/animation version from 5 to 4. Now I am getting this error even if I am compiling using JIT . 通过引用此答案,我将@angular/animation版本从5降级到4。现在,即使我使用JIT进行编译,也会遇到此错误。

Module '"C :/Codebase/cdf-onboarding/node_modules/@angular/animations/animations"' has no exported member 'AnimationBuilder'. 模块““ C:/ Codebase / cdf-onboarding / node_modules / @ angular / animations / animations”'没有导出的成员'AnimationBuilder'。

Module '"C :/Codebase/cdf-onboarding/node_modules/@angular/animations/animations"' has no exported member 'AnimationFactory'. 模块““ C:/ Codebase / cdf-onboarding / node_modules / @ angular / animations / animations”'没有导出的成员'AnimationFactory'。

Thanks! 谢谢!

Couple of things, you can try: 几件事情,您可以尝试:

1) you should import BrowserAnimationsModule from @angular/platform-browser/animations in your App NgModule. 1)您应该从应用程序NgModule中的@ angular / platform-b​​rowser / animations中导入BrowserAnimationsModule。

2) If you import any animations services or tools from @angular/core, you should import them from @angular/animations. 2)如果从@ angular / core导入任何动画服务或工具,则应从@ angular / animations导入它们。

3) please update angular versions too. 3)请也更新角度版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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