1

我正在使用xterm. Angular5但它在运行时抛出错误。

当我运行时ng serve,它会抛出这样的错误

ERROR in node_modules/xterm/typings/xterm.d.ts(10,1): error TS1084: Invalid 'reference' directive syntax

这是我的package.json文件

 `{
  "name": "paper-dashboard-pro-angular",
  "version": "1.1.0",
  "repository": {
  "type": "git",
  "url": "https://github.com/creativetimofficial/ct-paper-dashboard-pro- 
   angular.git"
  },
   "scripts": {
   "ng": "ng",
   "start": "ng serve",
   "build": "ng build",
   "test": "ng test",
   "lint": "ng lint",
   "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
  "@adactive/bootstrap-tagsinput": "0.8.2",
  "@agm/core": "1.0.0-beta.2",
  "@angular/animations": "^5.2.0",
  "@angular/common": "^5.2.0",
  "@angular/compiler": "^5.2.0",
  "@angular/core": "^5.2.0",
  "@angular/forms": "^5.2.0",
  "@angular/http": "^5.2.0",
  "@angular/platform-browser": "^5.2.0",
  "@angular/platform-browser-dynamic": "^5.2.0",
  "@angular/platform-server": "^5.2.0",
  "@angular/router": "^5.2.0",
  "@ng-bootstrap/ng-bootstrap": "^2.1.0",
  "@ngui/map": "0.30.3",
  "@types/googlemaps": "3.26.14",
  "ajv": "6.5.0",
  "bencode": "^2.0.0",
  "bootstrap": "4.1.0",
  "bootstrap-notify": "3.1.3",
  "bootstrap-select": "1.12.4",
  "bootstrap-tagsinput": "0.7.1",
  "chart.js": "2.7.2",
  "chartist": "0.11.0",
  "chartist-plugin-zoom": "0.4.0",
  "chartjs-plugin-zoom": "0.5.0",
  "core-js": "2.4.1",
  "datatables": "1.10.12",
  "datatables.net": "^1.10.19",
  "datatables.net-bs": "1.10.12",
  "datatables.net-bs4": "^1.10.19",
  "datatables.net-colreorder": "^1.5.1",
  "datatables.net-colreorder-bs4": "^1.5.1",
  "datatables.net-fixedcolumns": "^3.2.6",
  "datatables.net-fixedcolumns-bs4": "^3.2.6",
  "datatables.net-fixedheader-bs4": "^3.1.5",
  "datatables.net-responsive": "2.1.1",
  "datatables.net-responsive-bs4": "^2.2.3",
  "datatables.net-rowgroup-bs4": "^1.0.3",
  "datatables.net-scroller-bs4": "^1.5.1",
  "datatables.net-select-bs4": "^1.2.7",
  "easy-pie-chart": "2.1.7",
  "eonasdan-bootstrap-datetimepicker": "4.17.47",
  "fullcalendar": "3.4.0",
  "jasny-bootstrap": "3.1.3",
  "jquery": "3.2.1",
  "jvectormap": "2.0.4",
  "jw-bootstrap-switch-ng2": "1.0.10",
  "ngx-chips": "^1.9.2",
  "nouislider": "9.2.0",
  "perfect-scrollbar": "^1.4.0",
  "popper.js": "1.14.1",
  "rxjs": "^5.5.2",
  "rxjs-compat": "6.1.0",
  "sweetalert2": "7.22.0",
  "text-encoding": "^0.7.0",
  "twitter-bootstrap-wizard": "1.2.0",
  "web-animations-js": "2.3.1",
  "xterm": "^3.10.1",
  "zone.js": "0.8.26"
 },
 "devDependencies": {
"@angular-devkit/build-angular": "0.6.3",
"@angular/cli": "6.0.3",
"@angular/compiler-cli": "^5.2.0",
"@types/bootstrap": "3.3.32",
"@types/chartist": "0.9.34",
"@types/jasmine": "2.5.38",
"@types/jquery": "1.10.31",
"@types/node": "6.0.73",
"codelyzer": "4.3.0",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "3.2.0",
"karma": "2.0.2",
"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",
"protractor": "5.3.2",
"ts-node": "2.0.0",
"tslint": "5.9.1",
"typescript": "^2.5.3"
 }
}

像这样运行会引发错误

ERROR in node_modules/xterm/typings/xterm.d.ts(10,1): error TS1084: Invalid 'reference' directive syntax

我该如何解决?

4

1 回答 1

3

你能使用最新版本的打字稿吗?

如果您有能力升级打字稿,请尝试typescript 3.x使用版本来解决此问题。

注意:我在尝试集成xterm js时也面临同样的问题。升级打字稿版本后,这个问题为我解决了。

参考: 看这里

于 2019-03-18T14:03:11.630 回答