Angular 5 - 模块的错误元数据版本不匹配

时间:2017-12-18 03:13:01

标签: angular

尝试构建我的角度5项目时发生以下错误。我的版本是5.6.0,@ angular / material @ 5.0.1。

  

C:\ Users \ Owner \ ng7> ng build --prod日期:2017-12-18T02:42:21.623Z   哈希:2c0633800516bc024772时间:16640ms chunk {0}   styles.f7ba5027ddae0481d607.bundle.css(styles)290字节{3}   [initial] [rendering] chunk {1}   polyfills.3bc34265385d52184eab.bundle.js(polyfills)86字节{3}   [initial] [rendered] chunk {2} main.e402deade8b026b7d50e.bundle.js   (主要)84字节[初始] [渲染]块{3}   inline.9d07561b59257af76b95.bundle.js(inline)1.45 kB [entry]   [渲染]

     

错误中的错误:模块的元数据版本不匹配   C:/Users/Owner/ng7/node_modules/@angular/animations/animations.d.ts,   发现版本4,预计3       在StaticSymbolResolver.getModuleMetadata(C:\ Users \ Owner \ ng7 \ node_modules \ @angular \ compiler \ bundles \ compiler.umd.js:25616:34)       在StaticSymbolResolver._createSymbolsOf(C:\ Users \ Owner \ ng7 \ node_modules \ @angular \ compiler \ bundles \ compiler.umd.js:25404:46)       在StaticSymbolResolver.getSymbolsOf(C:\ Users \ Owner \ ng7 \ node_modules \ @angular \ compiler \ bundles \ compiler.umd.js:25385:14)       在C:\ Users \ Owner \ ng7 \ node_modules \ @angular \ compiler \ bundles \ compiler.umd.js:24241:30       在Array.forEach()       在extractProgramSymbols(C:\ Users \ Owner \ ng7 \ node_modules \ @angular \ compiler \ bundles \ compiler.umd.js:24240:79)       在AotCompiler.analyzeModulesAsync(C:\ Users \ Owner \ ng7 \ node_modules \ @angular \ compiler \ bundles \ compiler.umd.js:23796:47)       在CodeGenerator.codegen(C:\ Users \ Owner \ ng7 \ node_modules \ @angular \ compiler-cli \ src \ codegen.js:32:14)       在Function.NgTools_InternalApi_NG_2.codeGen(C:\ Users \ Owner \ ng7 \ node_modules \ @angular \ compiler-cli \ src \ ngtools_api.js:73:30)       在_donePromise.Promise.resolve.then(C:\ Users \ Owner \ ng7 \ node_modules \ @ngtools \ webpack \ src \ plugin.js:386:44)       在

1 个答案:

答案 0 :(得分:0)

在你的角度项目package.json文件中查看@ angular / animations模块并确保使用符合角度5的@ angular / animations版本。

来自您共享的错误日志

ERROR in Error: Metadata version mismatch for module C:/Users/Owner/ng7/node_modules/@angular/animations/animations.d.ts, found version 4, expected 3 at StaticSymbolResolver.getModuleMetadata 

我可以得出结论,你仍然处于角度4而不是角度5.请求你将你的所有依赖关系我的package.json更新为角度5,在你的情况下特别是角度动画模块。