我刚刚升级到 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 中工作的,如果我不导入这个模块一切正常,我就是看不到动画。
这是 4.2.3 中的错误,还是某处有重大更改?
谢谢
最佳答案
您在使用 Angular CLI 吗?升级后我遇到过这样的问题,但它们总是通过在我的项目和/或全局包中修改和重新创建 node_modules 目录结构来解决。
全局包:
npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@latest
本地项目包
rm -rf node_modules dist (use rmdir /S/Q node_modules dist in Windows Command >Prompt; use rm -r -fo node_modules,dist in Windows PowerShell)
npm install --save-dev @angular/cli@latest
npm install
不知道为什么会这样,但上面的过程似乎为我解决了这个问题。
关于node.js - 不再能够在 Angular 4.2.3 中导入 BrowserAnimationsModule,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44637102/