我最近表演了
npm update
命令并下拉Angular版本4.2.6。但是,当我跑了
ng build
我收到了一堆与@ angular / animations相关的构建错误。
见下文:
[alobban@linuxlaptop-advfrtsvr-advantagefreight-com afngine-ng2]$ ng build
Hash: eeeb38b2753a21366397
Time: 34119ms
chunk {0} main.bundle.js, main.bundle.js.map (main) 870 kB {4} [initial] [rendered]
chunk {1} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 160 kB {5} [initial] [rendered]
chunk {2} styles.bundle.js, styles.bundle.js.map (styles) 714 kB {5} [initial] [rendered]
chunk {3} scripts.bundle.js, scripts.bundle.js.map (scripts) 471 kB {5} [initial] [rendered]
chunk {4} vendor.bundle.js, vendor.bundle.js.map (vendor) 3.66 MB [initial] [rendered]
chunk {5} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]
ERROR in /usr/share/nginx/afngine-ng2/node_modules/@angular/platform-browser/animations/src/animation_builder.d.ts (8,10): Module '"/usr/share/nginx/afngine-ng2/node_modules/@angular/animations/animations"' has no exported member 'AnimationBuilder'.
/usr/share/nginx/afngine-ng2/node_modules/@angular/platform-browser/animations/src/animation_builder.d.ts (8,28): Module '"/usr/share/nginx/afngine-ng2/node_modules/@angular/animations/animations"' has no exported member 'AnimationFactory'.
/usr/share/nginx/afngine-ng2/node_modules/@angular/platform-browser/animations/src/animation_builder.d.ts (8,65): Module '"/usr/share/nginx/afngine-ng2/node_modules/@angular/animations/animations"' has no exported member 'AnimationOptions'.
ERROR in /usr/share/nginx/afngine-ng2/node_modules/@angular/platform-browser/animations/src/providers.d.ts (5,22): Non-abstract class 'InjectableAnimationEngine' does not implement inherited abstract member 'flush' from class 'AnimationEngine'.
/usr/share/nginx/afngine-ng2/node_modules/@angular/platform-browser/animations/src/providers.d.ts (5,22): Non-abstract class 'InjectableAnimationEngine' does not implement inherited abstract member 'listen' from class 'AnimationEngine'.
/usr/share/nginx/afngine-ng2/node_modules/@angular/platform-browser/animations/src/providers.d.ts (5,22): Non-abstract class 'InjectableAnimationEngine' does not implement inherited abstract member 'onInsert' from class 'AnimationEngine'.
/usr/share/nginx/afngine-ng2/node_modules/@angular/platform-browser/animations/src/providers.d.ts (5,22): Non-abstract class 'InjectableAnimationEngine' does not implement inherited abstract member 'onRemove' from class 'AnimationEngine'.
/usr/share/nginx/afngine-ng2/node_modules/@angular/platform-browser/animations/src/providers.d.ts (5,22): Non-abstract class 'InjectableAnimationEngine' does not implement inherited abstract member 'registerTrigger' from class 'AnimationEngine'.
/usr/share/nginx/afngine-ng2/node_modules/@angular/platform-browser/animations/src/providers.d.ts (5,22): Non-abstract class 'InjectableAnimationEngine' does not implement inherited abstract member 'setProperty' from class 'AnimationEngine'.
答案 0 :(得分:11)
以下是我为解决这些问题所做的工作。我跑了命令:
npm i @angular/animations@latest
或删除node_modules文件夹并重新运行
npm cache clean
npm i
按照@Z的建议。巴格
答案 1 :(得分:0)
升级角度时会出现此类错误。 您可以通过安装最新的animate库来解决 尽管更新导入语句也很重要。
就我而言-从Angular 5升级到Angular 7-我必须更改: 来自:
import { animate, state, style, transition, trigger } from '@angular/core';
至:
import { animate, state, style, transition, trigger } from '@angular/animations';