元数据版本不匹配的模块错误 [英] ERROR in Metadata version mismatch for module
问题描述
尝试构建我的角度项目时出现此错误:
I've got this error when trying to build my angular project :
模块的元数据版本不匹配错误C:/Users/Admin/ifinish-web/node_modules/angular2-cool-storage/index.d.ts,找到版本4,预期3,解析符号AppModule在C:/Users/Admin/ifinish-web/src/app/app.module.ts,解析符号C:/Users/Admin/ifinish-web/src/app/app.module.ts中的AppModule
ERROR in Metadata version mismatch for module C:/Users/Admin/ifinish-web/node_modules/angular2-cool-storage/index.d.ts, found ver sion 4, expected 3, resolving symbol AppModule in C:/Users/Admin/ifinish-web/src/app/app.module.ts, resolving symbol AppModule in C:/Users/Admin/ifinish-web/src/app/app.module.ts
推荐答案
这表明angular2-cool-storage需要Angular 5+,但是您的项目正在提供Angular4.要解决此问题,您可以:
This suggests angular2-cool-storage requires Angular 5+, but your project is supplying Angular 4. To resolve, you could either:
-
升级到Angular 5,或
Upgrade to Angular 5, or
将您的angular2-cool-storage依赖版本说明符固定到一个不依赖于Angular 4的早期版本.如果按照这种方法,看起来angular2-cool-storage依赖项只有一个发行版,因此您不能使用常规的npm模块依赖项,但是您需要使用 git依赖项,例如提交 9e230d4e20dd08eaa0a52ce3d08774614caf67dd .
Pin your angular2-cool-storage dependency version specifier to an earlier version that does not depend on Angular 4. If you go this route, it looks like angular2-cool-storage only has one release, so you cannot use a regular npm module dependency, but instead you would need to use a git dependency, e.g. on commit 9e230d4e20dd08eaa0a52ce3d08774614caf67dd.
我在这里发布了一个更通用的解决方案:
I posted a more general solution here: