文章内容

2019/1/28 15:53:08,作 者: 黄兵

ERROR in Error: Metadata version mismatch for module ....

最近在学习Angular的时候,找了一个开源程序运行,但是报如下错误:

ERROR in Error: Metadata version mismatch for module C:/Users/Eder/Desktop/Tesis
/Cliente/node_modules/@ng-bootstrap/ng-bootstrap/index.d.ts, found version 4, ex
pected 3, resolving symbol SharedModule in C:/Users/Eder/Desktop/Tesis/Cliente/s
rc/app/shared/shared.module.ts, resolving symbol SharedModule in C:/Users/Eder/D
esktop/Tesis/Cliente/src/app/shared/shared.module.ts, resolving symbol SharedMod
ule in C:/Users/Eder/Desktop/Tesis/Cliente/src/app/shared/shared.module.ts
at Error (native)
at syntaxError (C:\Users\Eder\Desktop\Tesis\Cliente\node_modules@angular\co
mpiler\bundles\compiler.umd.js:1729:34)
at simplifyInContext (C:\Users\Eder\Desktop\Tesis\Cliente\node_modules@angu
lar\compiler\bundles\compiler.umd.js:24979:23)
at StaticReflector.simplify (C:\Users\Eder\Desktop\Tesis\Cliente\node_module
s@angular\compiler\bundles\compiler.umd.js:24991:13)
at StaticReflector.annotations (C:\Users\Eder\Desktop\Tesis\Cliente\node_mod
ules@angular\compiler\bundles\compiler.umd.js:24418:41)
at _getNgModuleMetadata (C:\Users\Eder\Desktop\Tesis\Cliente\node_modules@a
ngular\compiler-cli\src\ngtools_impl.js:138:31)
at _extractLazyRoutesFromStaticModule (C:\Users\Eder\Desktop\Tesis\Cliente\n
ode_modules@angular\compiler-cli\src\ngtools_impl.js:109:26)
at C:\Users\Eder\Desktop\Tesis\Cliente\node_modules@angular\compiler-cli\sr
c\ngtools_impl.js:129:27
at Array.reduce (native)
at _extractLazyRoutesFromStaticModule (C:\Users\Eder\Desktop\Tesis\Cliente\n
ode_modules@angular\compiler-cli\src\ngtools_impl.js:128:10)
at Object.listLazyRoutesOfModule (C:\Users\Eder\Desktop\Tesis\Cliente\node_m
odules@angular\compiler-cli\src\ngtools_impl.js:53:22)
at Function.NgTools_InternalApi_NG_2.listLazyRoutes (C:\Users\Eder\Desktop\T
esis\Cliente\node_modules@angular\compiler-cli\src\ngtools_api.js:91:39)
at AotPlugin._getLazyRoutesFromNgtools (C:\Users\Eder\Desktop\Tesis\Cliente
node_modules@ngtools\webpack\src\plugin.js:207:44)
at _donePromise.Promise.resolve.then.then.then.then.then (C:\Users\Eder\Desk
top\Tesis\Cliente\node_modules@ngtools\webpack\src\plugin.js:443:24)
at process._tickCallback (internal/process/next_tick.js:109:7)


存在问题原因:

Angular4与bootstrap版本不兼容导致,需要修改。


解决方案:

在package.json中指定一个固定版本。

"@ng-bootstrap/ng-bootstrap": "1.0.0-beta.4",

beta.4与angular4兼容。

或者升级Angular版本也可以解决这个问题。


参考资料:ERROR in Error: Metadata version mismatch for module ....


黄兵个人博客原创。

转载请注明出处:黄兵个人博客 - ERROR in Error: Metadata version mismatch for module .... 

分享到:

发表评论

评论列表