如何解决angular core element_ref.d.ts中的给定错误?

时间:2018-06-01 12:30:23

标签: javascript angular typescript testing

ng test之后,

预期输出:测试执行,我看到x / x通过/失败测试。

实际输出:

Version: webpack 4.8.3
Time: 3128ms
Built at: 06/01/2018 2:12:39 PM
       Asset      Size     Chunks  Chunk Names
     main.js  6.21 KiB       main  main
polyfills.js  6.56 KiB  polyfills  polyfills
Entrypoint main = main.js
Entrypoint polyfills = polyfills.js
[./src/polyfills.ts] 0 bytes {polyfills} [built]
[0] multi ./src/polyfills.ts 28 bytes {polyfills} [built]
[./src/test.ts] 0 bytes {main} [built]

ERROR in node_modules/@angular/core/src/linker/element_ref.d.ts(20,35): error TS1005: ',' expected.

Chrome浏览器会打开,但会在60秒后停止。

的package.json:

{
  "name": "todo-app",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "json-server": "json-server --watch db.json"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.0.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/platform-browser": "^6.0.2",
    "@angular/platform-browser-dynamic": "^6.0.2",
    "@angular/router": "^6.0.2",
    "core-js": "^2.5.4",
    "json-server": "^0.12.2",
    "rxjs": "^6.0.0",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular/compiler-cli": "^6.0.2",
    "@angular-devkit/build-angular": "~0.6.3",
    "typescript": "~2.7.2",
    "@angular/cli": "~6.0.3",
    "@angular/language-service": "^6.0.2",
    "@types/jasmine": "~2.8.6",
    "@types/jasminewd2": "~2.0.3",
    "@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"
  }
}

请告知

1 个答案:

答案 0 :(得分:0)

通过https://www.npmjs.com/package/reinstall

重新安装所有依赖项