升级角度模板后,我遇到了一个错误

时间:2018-04-20 08:41:19

标签: angular npm

制作ng update并运行ng serve后出现此错误:

ERROR in node_modules/@agm/core/services/maps-api-loader/lazy-maps-api-loader.d.ts(1,10): error TS2305: Module '"/home/maroodb/WebstormProjects/user-dashboard-ng/node_modules/@angular/core/core"' has no exported member 'OpaqueToken'.

我认为这是由于从angular2升级到angular5引起的。但我没弄清楚如何解决这个问题。

更新 这是我的package.json

{
  "name": "guru-new-able",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@agm/core": "^1.0.0-beta.1",
    "@angular/animations": "^5.2.10",
    "@angular/common": "^5.2.10",
    "@angular/compiler": "^5.2.10",
    "@angular/core": "^5.2.10",
    "@angular/forms": "^5.2.10",
    "@angular/http": "^5.2.10",
    "@angular/platform-browser": "^5.2.10",
    "@angular/platform-browser-dynamic": "^5.2.10",
    "@angular/platform-server": "^5.2.10",
    "@angular/router": "^5.2.10",
    "@ng-bootstrap/ng-bootstrap": "^1.0.0-beta.5",
    "@nicky-lenaers/ngx-scroll-to": "^0.4.0",
    "@swimlane/ngx-datatable": "^9.3.0",
    "angular-froala-wysiwyg": "^1.0.0",
    "angular-io-slimscroll": "^1.2.11",
    "angular2-chartjs": "^0.3.0",
    "angular2-datatable": "^0.6.0",
    "angular2-material-datepicker": "^0.5.0",
    "angular2-notifications": "^0.7.8",
    "angular2-wizard": "^0.4.0",
    "bootstrap": "^4.0.0-beta",
    "c3": "^0.4.18",
    "core-js": "^2.4.1",
    "css-animator": "^2.1.1",
    "d3": "^4.11.0",
    "famfamfam-flags": "^1.0.0",
    "font-awesome": "^4.7.0",
    "jquery": "^3.2.1",
    "jquery-sparkline": "^2.4.0",
    "ng-click-outside": "^2.4.1",
    "ng-select": "^1.0.0-beta.6",
    "ng2-currency-mask": "^4.3.4",
    "ng2-file-upload": "^1.2.1",
    "ng2-google-charts": "^3.2.0",
    "ng2-nvd3": "^2.0.0",
    "ng2-toasty": "^4.0.3",
    "ng2-ui-switch": "^1.0.2",
    "ng2-validation": "^4.2.0",
    "ngx-bootstrap": "^1.9.3",
    "ngx-chips": "^1.4.6",
    "ngx-color-picker": "^4.4.0",
    "ngx-echarts": "^1.2.4",
    "ngx-quill-editor": "^2.2.2",
    "peity": "^3.2.1",
    "rxjs": "^5.5.10",
    "screenfull": "^3.3.1",
    "squeezebox": "^1.2.0",
    "sweetalert2": "^6.10.3",
    "ti-icons": "^0.1.2",
    "zone.js": "^0.8.14"
  },
  "devDependencies": {
    "@angular/cli": "1.4.2",
    "@angular/compiler-cli": "^5.2.10",
    "@angular/language-service": "^4.2.4",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "~3.1.1",
    "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",
    "protractor": "~5.1.2",
    "ts-node": "~3.2.0",
    "tslint": "~5.3.2",
    "typescript": "^2.4.2",
    "webpack-bundle-analyzer": "^2.9.0"
  }
}

1 个答案:

答案 0 :(得分:0)

如果您使用的是@ angular / flex-layout,则以下步骤可能有所帮助:

  • 删除您的node-modules目录
  • 删除项目package.json
  • 中的@ angular / flex-layout条目
  • 运行npm i; npm i @ angular / flex-layout

如果你没有使用flex-layout,可以提供更多信息(你的package.json)。