模块X的元数据版本不匹配错误,发现版本4,预期为3,解析符号Y [英] ERROR in Metadata version mismatch for module X found version 4, expected 3, resolving symbol Y

查看:189
本文介绍了模块X的元数据版本不匹配错误,发现版本4,预期为3,解析符号Y的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用angular-cli(ng build)构建一个使用ngx-clipboard的Angular 4应用程序.即使我的应用程序源代码没有更改,几天前我还是突然开始出现以下错误:

I'm trying to build an Angular 4 app with angular-cli (ng build) and which uses ngx-clipboard. I suddenly started getting the following error a few days ago, even though my application source code has not changed:

ERROR in Metadata version mismatch for module
ngx-clipboard/dist/index.d.ts, found version 4, expected 3, resolving
symbol AppModule in ...

如果我恢复到以前可以正常工作的提交,现在它仍然会以相同的方式失败.

If I revert to an older commit that used to work, it now still fails in the same way.

我正在使用npm进行软件包管理.摘录自我的package.json:

I'm using npm for package management. Excerpt from my package.json:

   "dependencies": {
     "@angular/animations": "4.0.0",
     "@angular/common": "4.0.0",
     "@angular/compiler": "4.0.0",
     "@angular/compiler-cli": "4.0.0",
     "@angular/core": "4.0.0",
     "@angular/forms": "4.0.0",
     "@angular/http": "4.0.0",
     "@angular/platform-browser": "4.0.0",
     "@angular/platform-browser-dynamic": "4.0.0",
     "@angular/platform-server": "4.0.0",
     "@angular/router": "4.0.0",
     "@types/highcharts": "^5.0.8",
     "angular2-busy": "^2.0.1",
     "bootstrap": "^3.3.6",
     "core-js": "^2.4.1",
     "element-resize-detector": "^1.1.11",
     "highcharts": "5.0.8",
     "jquery": "^1.11.3",
     "moment": "^2.10",
     "ng2-dragula": "^1.5.0",
     "ng2-tooltip": "0.0.7",
     "ngx-bootstrap": "^1.8.1",
     "ngx-clipboard": "^8.0.2",
     "ngx-clipboard": "~8.0.2",
     "ngx-popover": "0.0.16",
     "primeng": "4.1.0",
     "rxjs": "~5.0.3",
     "ts-helpers": "^1.1.2",
     "zone.js": "^0.8.4",
     "ngx-infinite-scroll": "^0.5.2",
     "ng-circle-progress": "0.9.6",
     "@ngx-translate/core": "^7.1.0"
   },
   "devDependencies": {
     "@angular/cli": "1.0.0",
     "@types/jasmine": "2.5.52",
     "codelyzer": "~3.0.1",
     "frisby": "~0.8.5",
     "jasmine-core": "2.6.3",
     "jasmine-reporters": "^2.2.1",
     "jasmine-spec-reporter": "4.1.0",
     "karma": "1.7.0",
     "karma-cli": "^1.0.1",
     "karma-jasmine": "^1.1.0",
     "karma-phantomjs-launcher": "^1.0.4",
     "karma-remap-istanbul": "^0.6.0",
     "protractor": "~5.2.0",
     "protractor-jasmine2-screenshot-reporter": "^0.5.0",
     "stylelint": "^7.11.0",
     "stylelint-config-standard": "^16.0.0",
     "ts-node": "3.3.0",
     "tslint": "~5.4.3",
     "typescript": "~2.3.4"
   }

推荐答案

请注意,依赖项"ngx-clipboard": "^8.0.2"现在解析为v8.1.2,这是最近的升级,其时间与生成错误相匹配.检查该版本与先前版本之间的差异 ngx-clipboard,其中包括对Angular 5的升级.

Note the dependency "ngx-clipboard": "^8.0.2" now resolves to v8.1.2, which is a recent upgrade whose timing matches the build error. Examining the diffs between that and the previous version of ngx-clipboard, they include an upgrade to Angular 5.

结果是生成错误消息指示Angular兼容性问题. ngx-clipboard需要Angular 5+,但从package.json中可以看出,目前提供了Angular 4.如果将ngx-clipboard依赖项版本说明符降级为8.1.1~8.0.2,则构建将再次通过.如果您改为升级到Angular 5,则构建也应该通过.

It turns out the build error message indicates an Angular compatibility problem. The ngx-clipboard requires Angular 5+, but as can be seen from package.json, Angular 4 is currently provided. If you downgrade the ngx-clipboard dependency version specifier back to 8.1.1 or ~8.0.2 the build passes again. If you instead upgrade to Angular 5, the build should also pass.

这是一种通用模式,适用于angular-cli中的构建错误ERROR in Metadata version mismatch for module <X> found version 4, expected 3, resolving symbol <Y>.

This is a general pattern that applies to the build error ERROR in Metadata version mismatch for module <X> found version 4, expected 3, resolving symbol <Y> from angular-cli.

升级到Angular 5或将依赖项(现在取决于Angular 5)降级到与Angular 4兼容的先前版本.

Upgrade to Angular 5 or downgrade the dependency (that now depends on Angular 5) to the prior version that is compatible with Angular 4.

此解决方案帮助我确定了问题:

This solution helped me identify the problem:

以下是具有相同模式的其他实例,具有相似的解决方案:

Here are additional instances of the same pattern, with similar solutions:

  • ERROR in Metadata version mismatch for module /node_modules/angular2-cool-storage/index.d.ts, found version 4, expected 3,
  • ERROR in Error: Metadata version mismatch for module ../node_modules/angularfire2/index.d.ts, found version 4, expected 3,
  • ERROR in Metadata version mismatch for module
  • Metadata version mismatch for module node_modules/ng2-emoji/ng2-emoji.d.ts, found version 3, expected 1

这篇关于模块X的元数据版本不匹配错误,发现版本4,预期为3,解析符号Y的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆