0

I tried to add material design to my angular project .I included the lines

"scripts": [

  "../node_modules/hammer.js/hammer.min.js"
    ]

and then i got the following errors:-

92% additional asset processing scripts-webpack-plugin✖ 「wdm」: Error: ENOENT: no such file or directory, open '/Users/ratnabhkumarrai/Desktop/Angular practice/node_modules/hammer.js/hammer.min.js'

Ratnabh Kumar Rai
  • 554
  • 2
  • 7
  • 24

1 Answers1

0

Try the following to including hammerjs. Either simply, import hammerjs in your src/main.ts file per the Angular Material getting starting documentation:

import 'hammerjs';

Or update your path if you are adding it in scripts of the @angular/cli configuration as hammerjs resides in a node_modules directory named hammerjs, not hammer.js (no . character between hammer and js):

"scripts": [
  "node_modules/hammerjs/hammer.min.js"
]

Hopefully that helps!

Alexander Staroselsky
  • 37,209
  • 15
  • 79
  • 91
  • Care to comment why the downvote? This was taken directly from the getting started documentation as well as @angular/cli global lib documentation. They got the error no such directory exactly because doing `npm install --save hammerjs` creates a folder named `hammerjs`, not `hammer.js` as the OP attempted. – Alexander Staroselsky Feb 07 '19 at 17:05