Cannot find module angular/animations

前端 未结 6 1263
梦如初夏
梦如初夏 2021-02-12 01:44

I am using webpack in angular2 and when i try to run my app i get an error stating

Cannot find module \"@angular/animations\"

6条回答
  •  情话喂你
    2021-02-12 02:28

    Perform below steps to make it work:

    1. npm install @angular/animations@latest --save

    2. import "BrowserAnimationsModule" from "@angular/platform-browser/animations" in your root NgModule (Without this, your code will compile and run, but animations will trigger an error)

    3. In your component use imports from the new package like this - " import { trigger, state, style, transition, animate } from '@angular/animations'; "

    This worked for me.

提交回复
热议问题