Module not found: Error: Can't resolve 'hammerjs'

Jan Nielsen

I updated my Angular 2 CLI project from 1.0.0-beta.11-webpack.2 to 1.0.0-beta.11-webpack.8 via ng init. My project uses Angular 2.0.0-rc.5 and Angular Material 2.0.0-alpha.7-4 but when run with ng serve I get the following error:

ERROR in ./src/app/app.module.ts
Module not found: Error: Can't resolve 'hammerjs' in '/home/jan/src/fm-repos/fm-ui/src/app'
 @ ./src/app/app.module.ts 38:0-18
 @ ./src/app/index.ts
 @ ./src/main.ts
 @ multi main

ERROR in [default] /home/jan/src/fm-repos/fm-ui/node_modules/@angular2-material/core/gestures/MdGestureConfig.d.ts:4:39 
Cannot find name 'HammerManager'.

ERROR in [default] /home/jan/src/fm-repos/fm-ui/node_modules/@angular2-material/slide-toggle/slide-toggle.d.ts:67:19 
Cannot find name 'HammerInput'.

ERROR in [default] /home/jan/src/fm-repos/fm-ui/node_modules/@angular2-material/slider/slider.d.ts:50:19 
Cannot find name 'HammerInput'.

ERROR in [default] /home/jan/src/fm-repos/fm-ui/node_modules/@angular2-material/slider/slider.d.ts:52:24 
Cannot find name 'HammerInput'.
Jan Nielsen

To work-around this bug, temporarily add hammerjs to your project:

npm install hammerjs --save
npm install @types/hammerjs --save-dev

and import in your module definition:

/** TODO: remove when work-around is not needed*/
import 'hammerjs';


@NgModule({
  declarations: [
    AppComponent,
    HeaderComponent,
    // ...

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Angular 6 setTimeout Module not found: Error: Can't resolve 'timers'

webpack: Module not found: Error: Can't resolve (with relative path)

Error: Module not found: Error: Can't resolve '@angular/cdk/scrolling'

Module not found: Error: Can't resolve '@angular/core'

Module not found: Error: Can't resolve 'fs'

Module not found: Error: Can't resolve 'ts-loader'

Module not found: Error: Can't resolve 'http' in selenium-webdriver

Module not found: Error: Can't resolve 'avoriaz'

Module not found: Error: Can't resolve './templates'

Module not found: Can't resolve

Rollup Module not found: Error: Can't resolve 'jquery'

React: Module not found: Error: Can't resolve 'react/lib/update'

NUXT: Module not found: Error: Can't resolve 'fs'

How to fix "Module not found: Error: Can't resolve *" error

Module not found: Error: Can't resolve 'dropzone'

Module not found: Error: Can't resolve 'module

Module not found: Can't resolve '@egjs/hammerjs' while installing React Native Gesture Handler

Module not found : error : Can't resolve 'ngx-bootstrap'

karma and CSS files: "Module not found: Error: Can't resolve"

Module not found: Error: Can't resolve 'ReactDOM'

Angular 8 - Module not found: Error: Can't resolve 'fs' in

Module not found: Error: Can't resolve 'http' in React

Module not found: Error: Can't resolve 'uuid' in

MUI : Module not found "Module not found: Error: Can't resolve 'moment' "

Module not found: Error: Can't resolve 'util'

Jest can't resolve path mappings and throws module not found error

Import Error: Module not found: Error: Can't resolve

Module not found: Error: Can't resolve 'crypto' in react browser project

Module not found: Error: Can't resolve './components'