angular – 找不到模块:错误:无法解析’hammerjs’

前端之家收集整理的这篇文章主要介绍了angular – 找不到模块:错误:无法解析’hammerjs’前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我通过ng init将我的Angular 2 CLI项目从1.0.0-beta.11-webpack.2更新到1.0.0-beta.11-webpack.8.我的项目使用Angular 2.0.0-rc.5和Angular Material 2.0.0-alpha.7-4但是当使用ng服务运行时,我收到以下错误
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'.
解决错误,请暂时将hammerjs添加到项目中:
npm install hammerjs --save
npm install @types/hammerjs --save-dev

并导入模块定义:

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


@NgModule({
  declarations: [
    AppComponent,HeaderComponent,// ...
原文链接:https://www.f2er.com/angularjs/142204.html

猜你在找的Angularjs相关文章