模块的元数据版本不匹配
Posted
技术标签:
【中文标题】模块的元数据版本不匹配【英文标题】:Metadata version mismatch for module 【发布时间】:2018-05-05 17:55:03 【问题描述】:昨天我的程序在 Angular 2 和 Angular Material 上运行良好,但是当我今天尝试运行时,它抛出了这个错误。帮帮我
错误中的错误:模块 E:/Demo/crud/ 的元数据版本不匹配 node_modules/@angular/material/card/typings/index.d.ts,找到的版本 4、预期3、在E:/Demo/crud/client/app/a中解析符号AppModule pp.module.ts,在 E:/Demo/crud/client/app/ap 中解析符号 AppModule p.module.ts [1] at Error (native) [1] at syntaxError (E:\Demo\crud\node_modules\@angular\compiler\bu ndles\compiler.umd.js:1729:34) [1] 在 simpleInContext (E:\Demo\crud\node_modules\@angular\compi ler\bundles\compiler.umd.js:25118:23) [1] 在 StaticReflector.simplify (E:\Demo\crud\node_modules\@angula r\compiler\bundles\compiler.umd.js:25130:13) [1] 在 StaticReflector.annotations (E:\Demo\crud\node_modules\@ang ular\compiler\bundles\compiler.umd.js:24558:41) [1] 在 _getNgModuleMetadata (E:\Demo\crud\node_modules\@angular\co mpiler-cli\src\ngtools_impl.js:138:31) [1] 在 _extractLazyRoutesFromStaticModule (E:\Demo\crud\node_modul es\@angular\compiler-cli\src\ngtools_impl.js:109:26) [1] 在 Object.listLazyRoutesOfModule (E:\Demo\crud\node_modules\@a ngular\compiler-cli\src\ngtools_impl.js:53:22) [1] 在 Function.NgTools_InternalApi_NG_2.listLazyRoutes (E:\Demo\c rud\node_modules\@angular\compiler-cli\src\ngtools_api.js:91:39) [1] 在 AotPlugin._getLazyRoutesFromNgtools (E:\Demo\crud\node_modu les\@ngtools\webpack\src\plugin.js:207:44) [1] 在 _donePromise.Promise.resolve.then.then.then.then.then (E:\Demo\crud\node_modules\@ngtools\webpack\src\plugin.js:443:24) [1] 在 process._tickCallback (internal/process/next_tick.js:109:7)
package.json
"dependencies":
"@angular/animations": "^5.0.2",
"@angular/cdk": "^5.0.0-rc.1",
"@angular/common": "^4.2.4",
"@angular/compiler": "^4.2.4",
"@angular/core": "^4.2.4",
"@angular/forms": "^4.2.4",
"@angular/http": "^4.2.4",
"@angular/material": "^5.0.0-rc.1",
"@angular/platform-browser": "^4.2.4",
"@angular/platform-browser-dynamic": "^4.2.4",
"@angular/router": "^4.2.4",
"@types/underscore": "^1.8.4",
"angular2-jwt": "^0.2.3",
"bcryptjs": "^2.4.3",
"body-parser": "^1.17.2",
"bootstrap": "4.0.0-alpha.5",
"core-js": "^2.4.1",
"dotenv": "^4.0.0",
"express": "^4.15.3",
"font-awesome": "^4.7.0",
"jquery": "^3.2.1",
"jsonwebtoken": "^8.0.1",
"mongodb": "^2.2.31",
"mongoose": "^4.12.1",
"mongoose-gen": "^2.1.1",
"mongoose-tie": "^1.0.0",
"morgan": "^1.8.2",
"rxjs": "^5.5.2",
"tether": "1.4.0",
"underscore": "^1.8.3",
"zone.js": "^0.8.14"
,
"devDependencies":
"@angular/cli": "1.4.2",
"@angular/compiler-cli": "^4.2.4",
"@angular/language-service": "^4.2.4",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"chai": "^4.1.0",
"chai-http": "^3.0.0",
"codelyzer": "~3.1.1",
"concurrently": "^3.3.0",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"mocha": "^3.4.2",
"nodemon": "1.11.0",
"protractor": "~5.1.2",
"ts-node": "~3.2.0",
"tslint": "~5.3.2",
"typescript": "~2.3.3"
由于我是新手,我希望得到一步一步的指导。谢谢
【问题讨论】:
检查你的 package.json 中的模块版本,这似乎与参考和安装的不匹配。您也可以尝试通过 npm install 再次安装所有 node_modules 我在上面添加了我的 package.json。 看起来您的角度版本可能由于某种原因不同步。您能否尝试删除整个E:/Demo/crud/node_modules/
文件夹,然后运行npm install
?
是否有任何命令可以删除 node_modules 或者我可以直接从文件中删除?
你有 angular 4 和 angular 5 混合,你应该同步它们
【参考方案1】:
正如您问题的评论者所说,您将 Angular 4 与 @angular/cdk@5.0.0-rc0
、@angular/material@5.0.0-rc0
混合使用。这些需要 Angular 5。
看看这个issue on the Angular Material 2 github repo。
您可以尝试更新 package.json
中的依赖项以匹配此处的依赖项:
"dependencies":
"@angular/animations": "5.0.0",
"@angular/cdk": "^5.0.0-rc0",
"@angular/common": "5.0.0",
"@angular/compiler": "5.0.0",
"@angular/core": "5.0.0",
"@angular/forms": "5.0.0",
"@angular/http": "5.0.0",
"@angular/material": "^5.0.0-rc0",
"@angular/platform-browser": "5.0.0",
"@angular/platform-browser-dynamic": "5.0.0",
"@angular/platform-server": "5.0.0",
"@angular/router": "5.0.0",
"core-js": "^2.5.1",
"hammerjs": "^2.0.8",
"rxjs": "5.5.2",
"zone.js": "^0.8.18"
,
"devDependencies":
"@angular/cli": "^1.5.3",
"@angular/compiler-cli": "5.0.0",
"@types/jasmine": "2.6.0",
"@types/node": "^8.0.34",
"codelyzer": "^3.2.1",
"ts-node": "~3.3.0",
"tslint": "~5.7.0",
"typescript": "2.4.2"
然后删除您的node_modules
文件夹并运行npm install
。
【讨论】:
以上是关于模块的元数据版本不匹配的主要内容,如果未能解决你的问题,请参考以下文章
转换的两个输入必须至少包含一个已排序的列,并且这些列必须具有匹配的元数据ssis