不再能够在Angular 4.2.3中导入BrowserAnimationsModule

我刚刚升级到了Angular 4.2.3,现在在我的AppModule文件的下面一行出现错误:

import { BrowserAnimationsModule } from "@angular/platform-browser/animations"; 

错误是:

 ./~/@angular/platform-browser/@angular/platform-browser/animations.es5.js 47:2-18 "export 'AnimationBuilder' was not found in '@angular/animations' ./~/@angular/platform-browser/@angular/platform-browser/animations.es5.js 78:2-18 "export 'AnimationFactory' was not found in '@angular/animations' ./~/@angular/platform-browser/@angular/platform-browser/animations.es5.js 612:15-31 "export 'AnimationBuilder' was not found in '@angular/animations' ./~/@angular/animations/@angular/animations/browser.es5.js 39:35-45 "export 'ɵPRE_STYLE' was not found in '@angular/animations' ./~/@angular/animations/@angular/animations/browser.es5.js 2275:29-39 "export 'ɵPRE_STYLE' was not found in '@angular/animations' ./~/@angular/animations/@angular/animations/browser.es5.js 3808:97-107 "export 'ɵPRE_STYLE' was not found in '@angular/animations' 

这是在Angular 4.1.2中工作,如果我不导入这个模块一切工作正常,我只是没有得到animation。

这是4.2.3中的一个错误,还是在某处发生了重大变化?

谢谢

你使用Angular CLI吗? 升级后,我遇到了类似这样的问题,但是它们总是通过在我的项目和/或全局包中nucking和重新创buildnode_modules目录结构来解决的。

全球套餐:

npm uninstall -g @ angular / cli

npmcaching清理

npm install -g @ angular / cli @ latest

本地项目包

rm -rf node_modules dist (在Windows命令>提示符下使用rmdir / S / Q node_modules dist;在Windows PowerShell中使用rm -r -fo node_modules,dist)

npm install –save-dev @ angular / cli @ latest

npm安装

不知道为什么会发生,但上述过程似乎为我解决了这个问题。