模块@ angular / material / core / typings / index.d.ts的元数据版本不匹配,找到版本4,预期3

时间:2018-03-18 18:36:20

标签: angular angular-material2

ng build失败并产生以下错误

ERROR in Error: Metadata version mismatch for module E:/angularWorkspace/klinik-web/node_modules/@angular/material/core/typings/index.d.ts, found version 4, expected 3, resolving symbol
 AppMaterialModule in E:/angularWorkspace/klinik-web/src/app/app-material.module.ts, resolving symbol AppMaterialModule in E:/angularWorkspace/klinik-web/src/app/app-material.module.ts
    at syntaxError (E:\angularWorkspace\klinik-web\node_modules\@angular\compiler\bundles\compiler.umd.js:1729:34)
    at simplifyInContext (E:\angularWorkspace\klinik-web\node_modules\@angular\compiler\bundles\compiler.umd.js:24979:23)
    at StaticReflector.simplify (E:\angularWorkspace\klinik-web\node_modules\@angular\compiler\bundles\compiler.umd.js:24991:13)
    at StaticReflector.annotations (E:\angularWorkspace\klinik-web\node_modules\@angular\compiler\bundles\compiler.umd.js:24418:41)
    at _getNgModuleMetadata (E:\angularWorkspace\klinik-web\node_modules\@angular\compiler-cli\src\ngtools_impl.js:138:31)
    at _extractLazyRoutesFromStaticModule (E:\angularWorkspace\klinik-web\node_modules\@angular\compiler-cli\src\ngtools_impl.js:109:26)
    at E:\angularWorkspace\klinik-web\node_modules\@angular\compiler-cli\src\ngtools_impl.js:129:27
    at Array.reduce (<anonymous>)
    at _extractLazyRoutesFromStaticModule (E:\angularWorkspace\klinik-web\node_modules\@angular\compiler-cli\src\ngtools_impl.js:128:10)
    at Object.listLazyRoutesOfModule (E:\angularWorkspace\klinik-web\node_modules\@angular\compiler-cli\src\ngtools_impl.js:53:22)
    at Function.NgTools_InternalApi_NG_2.listLazyRoutes (E:\angularWorkspace\klinik-web\node_modules\@angular\compiler-cli\src\ngtools_api.js:91:39)
    at AotPlugin._getLazyRoutesFromNgtools (E:\angularWorkspace\klinik-web\node_modules\@ngtools\webpack\src\plugin.js:240:66)
    at _donePromise.Promise.resolve.then.then.then.then.then (E:\angularWorkspace\klinik-web\node_modules\@ngtools\webpack\src\plugin.js:493:24)
    at <anonymous>

这是我的package.json文件

"dependencies": {
    "@angular/animations": "^4.4.6",
    "@angular/cdk": "^5.2.4",
    "@angular/common": "^4.2.4",
    "@angular/compiler": "^4.2.4",
    "@angular/core": "^4.2.4",
    "@angular/flex-layout": "^5.0.0-beta.13",
    "@angular/forms": "^4.2.4",
    "@angular/http": "^4.2.4",
    "@angular/material": "^5.2.4",
    "@angular/platform-browser": "^4.2.4",
    "@angular/platform-browser-dynamic": "^4.2.4",
    "@angular/router": "^4.2.4",
    "classlist.js": "^1.1.20150312",
    "core-js": "^2.4.1",
    "hammerjs": "^2.0.8",
    "rxjs": "^5.5.7",
    "web-animations-js": "^2.3.1",
    "zone.js": "^0.8.14"
  }

似乎是角度材料产生的错误。如果我排除这个包,它运行良好。我错过了什么?

1 个答案:

答案 0 :(得分:0)

我也面临这个错误。我的应用是角4.2.4和角材料5.2.4 ..我知道角度更新版本将解决这个问题。但我不想更新我的角版本4.2.4。那么有什么方法可以使用角度材料制作这个角度版本的4.2.4 ..?

的package.json

&#34; @ angular / common&#34;:&#34; ^ 4.2.4&#34;,     &#34; @ angular / compiler&#34;:&#34; ^ 4.2.4&#34;,     &#34; @ angular / core&#34;:&#34; ^ 4.2.4&#34;,

&#34; @角蛋白/ cdk&#34;:&#34; ^ 5.2.4&#34 ;, &#34; @角/材料&#34; :&#34; ^ 5.2.4&#34;