元数据版本与Angular 4不匹配

编程入门 行业动态 更新时间:2024-10-25 10:22:36
本文介绍了元数据版本与Angular 4不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用Angular 4应用程序,并通过"npm start"命令遇到以下错误-

I am working on Angular 4 application and getting below error with "npm start" command -

模块的元数据版本不匹配错误 C:/gitRepo/gmdias/gmdais-frontend/node_modules/@angular/animations/browser/browser.d.ts, 找到版本4,预期为3,在中解析符号inf C:/gitRepo/gmdias/gmdais-frontend/node_modules/@angular/platform-b​​rowser/animations/index.d.ts, 在中解析符号BrowserAnimationsModule C:/gitRepo/gmdias/gmdais-frontend/node_modules/@angular/platform-b​​rowser/animations/index.d.ts, 在中解析符号BrowserAnimationsModule C:/gitRepo/gmdias/gmdais-frontend/node_modules/@angular/platform-b​​rowser/animations/index.d.ts

ERROR in Metadata version mismatch for module C:/gitRepo/gmdias/gmdais-frontend/node_modules/@angular/animations/browser/browser.d.ts, found version 4, expected 3, resolving symbol ɵf in C:/gitRepo/gmdias/gmdais-frontend/node_modules/@angular/platform-browser/animations/index.d.ts, resolving symbol BrowserAnimationsModule in C:/gitRepo/gmdias/gmdais-frontend/node_modules/@angular/platform-browser/animations/index.d.ts, resolving symbol BrowserAnimationsModule in C:/gitRepo/gmdias/gmdais-frontend/node_modules/@angular/platform-browser/animations/index.d.ts

这是我的package.json文件

here is my package.json file

{ "name": "nucleus-web", "version": "1.0.0", "license": "MIT", "scripts": { "transpile": "ngc", "package": "rollup -c", "minify": "uglifyjs dist/bundles/datatable.umd.js --screw-ie8 --compress --mangle --comments --output dist/bundles/datatable.min.js", "build": "npm run transpile && npm run package && npm run minify && ng build", "ng": "ng", "start": "ng serve", "postinstall": "ng build", "test": "sh build.sh" }, "private": true, "peerDependencies": { "@angular/core": "^4.0.1" }, "dependencies": { "@angular/animations": "^5.0.0", "@angular/cdk": "^2.0.0-beta.12", "@angular/common": "^4.0.1", "@angular/compiler": "^4.0.0", "@angular/core": "^4.0.1", "@angular/forms": "^4.0.1", "@angular/http": "^4.0.0", "@angular/material": "^2.0.0-beta.12", "@angular/platform-browser": "^4.2.5", "@angular/platform-browser-dynamic": "^4.0.1", "@angular/platform-server": "^4.4.4", "@angular/router": "^4.0.0", "@ng-bootstrap/ng-bootstrap": "^1.0.0-beta.5", "bootstrap": "3.3.7", "core-js": "^2.4.1", "font-awesome": "^4.7.0", "jquery": "^3.2.1", "lodash": "^4.17.4", "ng2-file-upload": "^1.2.1", "ng2-toastr": "^4.1.2", "ngx-bootstrap": "^1.7.1", "ngx-treeview": "1.2.3", "ngx-webstorage": "^1.8.0", "rxjs": "^5.1.0", "zone.js": "^0.8.12" }, "devDependencies": { "@angular/cli": "1.0.3", "@types/jasmine": "2.5.38", "@types/jquery": "^3.2.15", "@types/node": "~8.0.33", "codelyzer": "~2.0.0", "jasmine-core": "~2.5.2", "jasmine-spec-reporter": "~3.2.0", "karma": "~1.4.1", "karma-chrome-launcher": "~2.1.1", "karma-cli": "~1.0.1", "karma-coverage-istanbul-reporter": "^0.2.0", "karma-jasmine": "~1.1.0", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~5.1.0", "ts-node": "~3.3.0", "tslint": "~4.5.0", "@angular/compiler": "^4.4.4", "@angular/compiler-cli": "^4.4.4", "rollup": "^0.50.0", "typescript": "^2.5.3", "uglify-js": "^3.1.3" }, "repository": { "type": "git", "url": "ssh://git@stash.aexp/stash/scm/pzn/gmdais-frontend.git" } }

推荐答案

您的@angular/animations在版本5.x.x上,其他@angular/软件包在4.x.x上.所有@angular/*软件包都必须对齐,即该应用具有完全相同的版本号才能编译.

Your @angular/animations is on version 5.x.x and other @angular/ packages are on 4.x.x. All @angular/* packages must be aligned, i.e. have the exact same version number for the app to be able to compile.

您得到的具体错误来自其中包含"version"字段的.metadata.json文件. @angular/*@4.x.x使用版本3,@angular/*@5.x.x使用版本4(暂时).

The concrete error you're gettings comes from the .metadata.json files which have a "version" field inside. @angular/*@4.x.x uses version 3 and @angular/*@5.x.x uses version 4 (for now).

更多推荐

元数据版本与Angular 4不匹配

本文发布于:2023-10-18 23:57:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1505802.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不匹配   版本   数据   Angular

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!