没有AnimationEngine的提供者

时间:2017-09-16 20:16:12

标签: angular asp.net-core angular-material2

我刚刚将我的依赖项更新为最新的

"@angular/animations": "4.4.1",
"@angular/cdk": "2.0.0-beta.10",
"@angular/common": "4.4.1",
"@angular/compiler": "4.4.1",
"@angular/compiler-cli": "4.4.1",
"@angular/core": "4.4.1",
"@angular/forms": "4.4.1",
"@angular/http": "4.4.1",
"@angular/material": "2.0.0-beta.10",
"@angular/platform-browser": "4.4.1",
"@angular/platform-browser-dynamic": "4.4.1",
"@angular/platform-server": "4.4.1",
"@angular/router": "4.4.1",

并开始出现以下错误。知道它可能是什么吗?

  

我看到有人建议添加@angular/platform-browser/animations,但也会发现它现在在@angular/animations

An unhandled exception occurred while processing the request.

NodeInvocationException: No provider for AnimationEngine!
Error: No provider for AnimationEngine!
at Error (native)
at injectionError (C:\Source\vsts\myusername\DefaultCollection\MyFolder\MyProject.Web\ClientApp\dist\vendor.js:1533:90)
at noProviderError (C:\Source\vsts\myusername\DefaultCollection\MyFolder\MyProject.Web\ClientApp\dist\vendor.js:1571:12)
at ReflectiveInjector_.module.exports.ReflectiveInjector_._throwOrNull (C:\Source\vsts\myusername\DefaultCollection\MyFolder\MyProject.Web\ClientApp\dist\vendor.js:3013:19)
at ReflectiveInjector_.module.exports.ReflectiveInjector_._getByKeyDefault (C:\Source\vsts\myusername\DefaultCollection\MyFolder\MyProject.Web\ClientApp\dist\vendor.js:3052:25)
at ReflectiveInjector_.module.exports.ReflectiveInjector_._getByKey (C:\Source\vsts\myusername\DefaultCollection\MyFolder\MyProject.Web\ClientApp\dist\vendor.js:2984:25)
at ReflectiveInjector_.module.exports.ReflectiveInjector_.get (C:\Source\vsts\myusername\DefaultCollection\MyFolder\MyProject.Web\ClientApp\dist\vendor.js:2853:21)
at resolveNgModuleDep (C:\Source\vsts\myusername\DefaultCollection\MyFolder\MyProject.Web\ClientApp\dist\vendor.js:9853:25)
at _callFactory (C:\Source\vsts\myusername\DefaultCollection\MyFolder\MyProject.Web\ClientApp\dist\vendor.js:9931:73)
at _createProviderInstance$1 (C:\Source\vsts\myusername\DefaultCollection\MyFolder\MyProject.Web\ClientApp\dist\vendor.js:9867:26)

在我的 app.module.browser.ts

// ...
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

@NgModule({
    // ...
    imports: [
        // ...
        BrowserAnimationsModule
    ],
    // ...
})

// ...

2 个答案:

答案 0 :(得分:2)

只需将您的角度降级为4.3.x @angular/material,而@angular/cdk不支持4.4.x:

npm install @angular/{animations,platform-browser,common,compiler,core,forms,http,platform-browser-dynamic,platform-server,router}@~4.3.0 --save
npm install @angular/compiler-cli --save-dev

答案 1 :(得分:0)

我最近遇到了这个问题。我按照Edric的建议添加了BrowserAnimationsModule,并且它起作用了。