Angular NoopAnimationsModule Type Error matches El

2019-04-18 07:24发布

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)

4条回答
混吃等死
2楼-- · 2019-04-18 07:44

@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楼-- · 2019-04-18 07:53

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楼-- · 2019-04-18 08:03

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.

查看更多
兄弟一词,经得起流年.
5楼-- · 2019-04-18 08:06

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

Running npm update --save fixed it.

查看更多
登录 后发表回答