【问题标题】:No longer able to import BrowserAnimationsModule in Angular 4.2.3不再能够在 Angular 4.2.3 中导入 BrowserAnimationsModule
【发布时间】:2017-11-22 01:20:28
【问题描述】:

我刚刚升级到 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 中的错误,还是某处发生了重大变化?

谢谢

【问题讨论】:

    标签: node.js angular typescript webpack


    【解决方案1】:

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

    全局包:

    npm 卸载 -g @angular/cli

    npm 缓存清理

    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 安装

    不知道为什么会这样,但上面的过程似乎为我解决了这个问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-12-15
      • 1970-01-01
      • 1970-01-01
      • 2021-12-04
      • 2019-05-24
      • 2021-10-25
      • 2019-05-16
      相关资源
      最近更新 更多