I'm working on a simple angular project where I am trying to import Material Design into my project but some of the components aren't working properly and a console warning says:
Could not find HammerJS. Certain Angular Material components may not work correctly.
I have hammerjs installed and also @angular/material. How do I resolve this issue?
Sidenote
It may be worth noting that if you have hammerjs installed and your components are still not rendering correctly to make sure you are using angular material components and not html elements with materialize-css classes.
If you are using materialize-css instead of angular material, you will need to add it to your project separately.

In your
package.jsonfile add this todependenciesOr if you want an alternative automatic way just you can type
npm i hammerjs --save(ornpm i [email protected] --saveif you want, since2.0.8is the latest version nowdays) in your root project folder and test then, if the problem still occurring try to delete thenode_modulesfolder and reinstall it in the root project folder also by runningnpm installwhich will check thedependencies(wherehammerjsresides),devDependencies..., inpackage.jsonfile and install them.Also in your
polyfills.ts(recommended to have a one if you have not)Thus, it would be found while your angular app is executed since
polyfills.tsitself is called by import (in a normal case, else you can check it) inmain.tswhich is the angular apps' entry point.