node.js - 不再能够在 Angular 4.2.3 中导入 BrowserAnimationsModule

标签 node.js angular typescript webpack

我刚刚升级到 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/

相关文章:

node.js - 使用 passport-reddit 从 Reddit 返回电子邮件

node.js - 使用 Redis 异步等待函数存储 token 不起作用。 async await 是否适用于 Redis?

javascript - 使用 Node 签署 AWS API Gateway 请求

angular - 更改angular5中的插值符号

typescript - 为什么 SceneView 渲染不正确

javascript - Angular:多选下拉 ID

html - 使用 Node JS 输入/设置/更改 HTML img src

javascript - 单步进入数据流并输出经过过滤的数据数组 Rxjs

angular - Angular 2 中的导入语句

typescript - TypeScript 中的动态类型