2017-06-19 59 views
4

我刚刚升级到4.2.3角,和我现在越来越下一行的错误在我的AppModule文件:不再能够导入BrowserAnimationsModule在角4.2.3

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中工作,如果我不导入此模块一切工作正常,我只是没有得到动画。

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

谢谢

回答

3

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

全球包装:

NPM卸载-g @角/ CLI

NPM缓存清理

NPM安装-g @角/ CLI @最新

本地项目包

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

NPM安装--save-dev的@角/ CLI @最新

NPM安装

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