[Resolved] Cannot find module ‘@angular/animations’

[Resolved] Cannot find module ‘@angular/animations’

When you are using angular material with angular 4 then you will come across this error “Cannot find module ‘@angular/animations’“.

In angular 2 when you install angular material angular animations also will be installed and imported from core. but now in angular 4 angular animation is moved to a separate package and angular/core is deprecated.

So inorder to make the animation work properly with angular 4 then you need to install angular animation separately,

npm install –save @angular/animations@latest

After the successful installation, import the angular animation in ngModule:

import { BrowserAnimationsModule } from ‘@angular/platform-browser/animations’;

Also in,

imports: [
BrowserModule,
FormsModule,
HttpModule,
BrowserAnimationsModule,
MaterialModule
],

For more details, you can check the following links:

https://github.com/angular/material2/issues/3760

http://angularjs.blogspot.in/2017/03/angular-400-now-available.html

 

Leave a Reply