Angular NoopAnimationsModule Type Error matches Element is not a function

萝らか妹 提交于 2019-12-22 02:49:14

问题


I'm getting this error after importing NoopAnimationsModule for my Angular 6 app

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

回答1:


This happened to me a few hours ago, and was probably caused by some outdated modules.

Running npm update --save fixed it.




回答2:


@angular/core and @angular/animations should be same version.
Especially look for "^" symbol in package name in package.json.

It should be

"@angular/core": "6.0.5",
"@angular/animations": "6.0.5",

and not like

"@angular/core": "6.0.5",
"@angular/animations": "^6.0.5",



回答3:


Had the same problem after adding the BrowserAnimationsModule. Fixed by putting in the correct order the imports of BrowserAnimationsModule the app.module.ts: imports: [ BrowserModule, AppRoutingModule, **BrowserAnimationsModule**, MatDialogModule, FormsModule, ReactiveFormsModule, HttpClientModule,




回答4:


I got the same error while developing in Angular 6.0, but it works for me in npm Version 6.0.3. So, delete node_module in your project, install the latest version of npm latest, and try again.



来源:https://stackoverflow.com/questions/51007544/angular-noopanimationsmodule-type-error-matches-element-is-not-a-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!