首页 > 解决方案 > 模块 node_modules/angular-2-local-storage/dist/index.d.ts 元数据版本不匹配中的错误,找到版本 4,预期为 3

问题描述

我正在使用 Angular2 应用程序并使用npm start命令得到以下错误。这是模块 /home/x/Desktop/koohbaad-web/node_modules/angular-2-local-storage/dist/index.d.ts 元数据版本不匹配中的整个代码错误,找到版本 4,预期 3,解析符号 AppModule在/home/x/Desktop/koohbaad-web/src/app/app.module.ts,解析符号AppModule 在/home/x/Desktop/koohbaad-web/src/app/app.module.ts,解析符号AppModule在 /home/x/Desktop/koohbaad-web/src/app/app.module.ts

这是我的 package.json 文件

{
  "name": "koohbad-tour",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve --host 192.168.1.193",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@agm/core": "^1.0.0-beta.0",
    "@angular/animations": "^4.*",
    "@angular/common": "^4.0.0",
    "@angular/compiler": "^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/router": "^4.0.0",
    "@types/underscore": "^1.8.0",
    "angular-2-local-storage": "*",
    "angular-star-rating": "^3.0.8",
    "angular2-masonry": "^0.4.0",
    "angular2-recaptcha": "*",
    "angular2-text-mask": "^8.0.1",
    "core-js": "^2.4.1",
    "enhanced-resolve": "^3.3.0",
    "jquery": "^3.2.1",
    "ng-lazyload-image": "^3.3.3",
    "ng-select": "^1.0.0-beta.5",
    "ng2-select2": "^1.0.0-beta.10",
    "ngx-infinite-scroll": "^0.5.1",
    "node-sass": "^4.7.2",
    "rxjs": "^5.1.0",
    "screenfull": "^3.3.1",
    "underscore": "*",
    "web-animations-js": "^2.2.5",
    "zone.js": "^0.8.4",
    "ngx-swiper-wrapper": "4.0.0"
  },
  "devDependencies": {
    "@angular/cli": "1.0.0",
    "@angular/compiler-cli": "^4.0.0",
    "@types/jasmine": "2.5.38",
    "@types/jquery": "^2.0.42",
    "@types/node": "~6.0.60",
    "codelyzer": "~2.0.0",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "~3.2.0",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "~2.0.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "ngx-dropzone-wrapper": "^4.0.3",
    "protractor": "~5.1.0",
    "ts-node": "~2.0.0",
    "tslint": "~4.5.0",
    "typescript": "~2.2.0"
  }
}

我得到的错误是

模块 node_modules/angular-2-local-storage/dist/index.d.ts 元数据版本不匹配中的错误,找到版本 4,预期为 3 在此处输入图像描述

请帮帮我。

标签: angularangular-local-storage

解决方案


这是因为 angular-2-local-storage 是使用 Angular 5 构建的,并且它生成了元数据文件版本 4(您的编译器无法理解,因为您的 Angular 4 项目只能读取版本 3 之前的元数据文件)我推荐你将您的项目更新到 Angular 5 并重试


推荐阅读