2

包.json

{
  "name": "trackerui",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build --bh /trackerui/",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.0.2",
    "@angular/cdk": "^6.3.2",
    "@angular/common": "^6.0.2",
    "@angular/compiler": "^6.0.2",
    "@angular/core": "^6.0.2",
    "@angular/forms": "^6.0.2",
    "@angular/http": "^6.0.2",
    "@angular/material": "^6.3.2",
    "@angular/router": "^6.0.2",
    "ag-grid": "^18.1.2",
    "ag-grid-community": "^20.1.0",
    "ag-grid-enterprise": "^20.1.0",
    "angular-calendar": "^0.26.4",
    "angular-tree-component": "^7.2.1",
    "bootstrap": "^3.3.7",
    "core-js": "^2.5.4",
    "date-fns": "^1.30.1",
    "file-saver": "1.3.8",
    "jquery": "^3.3.1",
    "jquery-ui": "^1.12.1",
    "ng2-file-upload": "^1.3.0",
    "npm": "^6.3.0",
    "rxjs": "^6.0.0",
    "rxjs-compat": "^6.3.3",
    "to": "^0.2.9",
    "update": "^0.7.4",
    "xlsx": "0.12.13",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.6.3",
    "@angular/cli": "~6.0.3",
    "@angular/compiler-cli": "^6.0.2",
    "@angular/language-service": "^6.0.2",
    "@types/jasmine": "~2.8.6",
    "@types/jasminewd2": "~2.0.3",
    "@types/jquery": "^3.2.5",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.2.1",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~1.7.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~1.4.2",
    "karma-jasmine": "~1.1.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.3.0",
    "ts-node": "~5.0.1",
    "tslint": "~5.9.1",
    "typescript": "~2.7.2"
  }
}

使用运行应用程序时出现以下错误ng serve

  • node_modules/ag-grid-community/dist/lib/gridOptionsWrapper.d.ts(133,52) 中的错误:错误 TS1005:“,”预期。
  • node_modules/ag-grid-community/dist/lib/gridOptionsWrapper.d.ts(133,73): 错误 TS1144: '{' or ';' 预期的。
  • node_modules/ag-grid-community/dist/lib/gridOptionsWrapper.d.ts(133,101): 错误 TS1005: ';' 预期的。
  • node_modules/ag-grid-community/dist/lib/gridOptionsWrapper.d.ts(133,103):错误 TS1068:意外的令牌。需要构造函数、方法、访问器或属性。
4

1 回答 1

3

我认为您还需要升级"ag-grid": "^18.1.2","ag-grid-angular": "^20.1.0",这样做,您需要遵循更改

Step1: 去package.json修改"ag-grid": "^18.1.2","ag-grid-angular": "20.1.0",

第2步:将您的打字稿版本更改"typescript": "~2.7.2""typescript": "~3.2.4"

第三步:npm update在你的项目中运行。

Step4:现在运行ng serve

这是 Stackblitz 演示

希望这会有所帮助!

于 2019-03-12T07:27:56.943 回答