首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >元数据版本与角4不匹配

元数据版本与角4不匹配
EN

Stack Overflow用户
提问于 2017-11-04 21:07:07
回答 8查看 49.5K关注 0票数 27

我正在使用"npm启动“命令处理角4应用程序,并获得以下错误-

模块C:/gitRepo/gmdias/gmdais-frontend/node_modules/@angular/animations/browser/browser.d.ts,元数据版本错配错误发现版本4,预期3,解析C:/gitRepo/gmdias/gmdais-frontend/node_modules/@angular/platform-browser/animations/index.d.ts,中的符号ɵf在C:/gitRepo/gmdias/gmdais-frontend/node_modules/@angular/platform-browser/animations/index.d.ts,中解析符号BrowserAnimationsModule在C:/gitRepo/gmdias/gmdais-frontend/node_modules/@angular/platform-browser/animations/index.d.ts中解析符号BrowserAnimationsModule

这是我的package.json文件

代码语言:javascript
运行
复制
{
  "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.com/stash/scm/pzn/gmdais-frontend.git"
  }
}
EN

回答 8

Stack Overflow用户

回答已采纳

发布于 2017-11-04 22:13:57

您的@angular/animations5.x.x版本上,其他@angular/包在4.x.x上。所有@angular/*包都必须对齐,即应用程序能够编译的版本号完全相同。

您得到的具体错误来自于.metadata.json文件,其中有一个"version"字段。@angular/*@4.x.x使用版本3,@angular/*@5.x.x使用版本4(目前)。

票数 29
EN

Stack Overflow用户

发布于 2017-12-26 18:22:12

问题解决了:只需在项目目录位置的终端上运行此命令:

代码语言:javascript
运行
复制
npm install @angular/animations@'^5.0.0' @angular/common@'^5.0.0' @angular/compiler@'^5.0.0' @angular/compiler-cli@'^5.0.0' @angular/core@'^5.0.0' @angular/forms@'^5.0.0' @angular/http@'^5.0.0' @angular/platform-browser@'^5.0.0' @angular/platform-browser-dynamic@'^5.0.0' @angular/platform-server@'^5.0.0' @angular/router@'^5.0.0' typescript@2.4.2 rxjs@'^5.5.2'

上面的命令基本上是将不同的角度模块更新到版本5。

语法:

npm安装@angular/moduleName'^5.0.0‘

票数 8
EN

Stack Overflow用户

发布于 2017-11-17 02:59:11

当从4更新到5时,我也遇到了同样的问题。问题是,我只更新了prod依赖项,但忘记了更新dev依赖项。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47115649

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档