Angular 应用:"export 'AnimationBuilder' was not found in '@angular/animations'"
Angular App: "export 'AnimationBuilder' was not found in '@angular/animations'"
我有一个 Angular4 应用程序(由 hyperledger composer 自动生成)。
我使用以下命令安装了 angular/animations:
npm install --save @angular/animations@4.0.0
我收到以下警告:
@angular/animations@4.0.0 requires a peer of @angular/core@4.0.0 but none is installed. You must install peer dependencies yourself.
此警告没有意义,因为已安装 Angular/core@4.0.0(package.json 文件的屏幕截图):
无论如何...当 运行 应用程序时,浏览器中的一切看起来都很好。但是在控制台中,显示如下错误信息:
Error: Found the synthetic property @transitionMessages. Please include either "BrowserAnimationsModule" or "NoopAnimationsModule" in your application.
然而,导入 BrowserAnimationsModule 后,整个应用程序崩溃了。
在浏览器中,显示以下错误消息:
我该如何解决这个问题?
首先
This warning warning made no sense because Angular/core@4.0.0 is installed.
在您的依赖项中,您有 @angular/core: ^4.0.0
。请注意开头的插入符号 (^)。插入符号 installs the most recent major version。这就是为什么你有一个未满足的依赖错误:你可能有一个最新的 4+ 版本的 @angular/core
,但另一方面,你正在明确安装 4.0.0
版本的 @angular/animations
.您可以通过进入 node_modules
并导航至 @angular > core > package.json
.
来检查您实际使用的 @angular/core
的确切版本
至于你的主要问题,我相信 AnimationBuilder 是在 Angular 4.2 中添加的,所以这就是你可能遇到问题的原因,因为你正在安装 4.0.0
。将 package.json
中的条目 @angular/animations: 4.0.0
更改为 @angular/animations: ^4.0.0
,然后再次删除 node_modules
和 运行 npm i
。
我有一个 Angular4 应用程序(由 hyperledger composer 自动生成)。
我使用以下命令安装了 angular/animations:
npm install --save @angular/animations@4.0.0
我收到以下警告:
@angular/animations@4.0.0 requires a peer of @angular/core@4.0.0 but none is installed. You must install peer dependencies yourself.
此警告没有意义,因为已安装 Angular/core@4.0.0(package.json 文件的屏幕截图):
无论如何...当 运行 应用程序时,浏览器中的一切看起来都很好。但是在控制台中,显示如下错误信息:
Error: Found the synthetic property @transitionMessages. Please include either "BrowserAnimationsModule" or "NoopAnimationsModule" in your application.
然而,导入 BrowserAnimationsModule 后,整个应用程序崩溃了。
在浏览器中,显示以下错误消息:
我该如何解决这个问题?
首先
This warning warning made no sense because Angular/core@4.0.0 is installed.
在您的依赖项中,您有 @angular/core: ^4.0.0
。请注意开头的插入符号 (^)。插入符号 installs the most recent major version。这就是为什么你有一个未满足的依赖错误:你可能有一个最新的 4+ 版本的 @angular/core
,但另一方面,你正在明确安装 4.0.0
版本的 @angular/animations
.您可以通过进入 node_modules
并导航至 @angular > core > package.json
.
@angular/core
的确切版本
至于你的主要问题,我相信 AnimationBuilder 是在 Angular 4.2 中添加的,所以这就是你可能遇到问题的原因,因为你正在安装 4.0.0
。将 package.json
中的条目 @angular/animations: 4.0.0
更改为 @angular/animations: ^4.0.0
,然后再次删除 node_modules
和 运行 npm i
。