Angular NoopAnimationsModule类型错误匹配元素不是函数

Thi*_*sta 17 angular angular-animations angular6

我为Angular 6应用程序导入NoopAnimationsModule后出现此错误

ERROR TypeError: this.driver.matchesElement is not a function
    at TransitionAnimationEngine.push../node_modules/@angular/animations/fesm5/browser.js.TransitionAnimationEngine.processLeaveNode (browser.js:2976)
Run Code Online (Sandbox Code Playgroud)

小智 18

这在几个小时前发生在我身上,可能是由一些过时的模块造成的.

运行npm update --save修复它.

  • 在npm update之前--save建议先删除node_modules (2认同)

Aru*_*run 9

@angular/core和@ angular/animations应该是相同的版本.
特别是在包名中查找"^"符号package.json.

它应该是

"@angular/core": "6.0.5",
"@angular/animations": "6.0.5",
Run Code Online (Sandbox Code Playgroud)

而不是喜欢

"@angular/core": "6.0.5",
"@angular/animations": "^6.0.5",
Run Code Online (Sandbox Code Playgroud)