samedi 28 avril 2018

Unespected errors when running 'ng test' or 'ng build'

My cmd displays those errors when I try to run 'ng test' and 'ng build' inside of the root directory of my Angular 5 project, but it doesn't when I run 'ng serve'.

The errors are:

ERROR in node_modules/@angular/cdk/a11y/typings/aria-describer.d.ts(15,21): error TS2304: Cannot find name 'Element'.
node_modules/@angular/cdk/a11y/typings/aria-describer.d.ts(39,27): error TS2304: Cannot find name 'Element'.
node_modules/@angular/cdk/a11y/typings/aria-describer.d.ts(41,36): error TS2304: Cannot find name 'Element'.
node_modules/@angular/cdk/a11y/typings/fake-mousedown.d.ts(15,64): error TS2304: Cannot find name 'MouseEvent'.
node_modules/@angular/cdk/a11y/typings/focus-monitor.d.ts(38,22): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/cdk/a11y/typings/focus-monitor.d.ts(46,22): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/cdk/a11y/typings/focus-monitor.d.ts(51,29): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/cdk/a11y/typings/focus-monitor.d.ts(57,23): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/cdk/a11y/typings/focus-monitor.d.ts(89,20): error TS2304: Cannot find name 'FocusEvent'.
node_modules/@angular/cdk/a11y/typings/focus-monitor.d.ts(89,41): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/cdk/a11y/typings/focus-trap.d.ts(27,27): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/cdk/a11y/typings/focus-trap.d.ts(27,100): error TS2304: Cannot find name 'Document'.
node_modules/@angular/cdk/a11y/typings/focus-trap.d.ts(99,21): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/cdk/a11y/typings/interactivity-checker.d.ts(15,25): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/cdk/a11y/typings/interactivity-checker.d.ts(24,24): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/cdk/a11y/typings/interactivity-checker.d.ts(32,25): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/cdk/a11y/typings/interactivity-checker.d.ts(39,26): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/cdk/a11y/typings/list-key-manager.d.ts(56,22): error TS2304: Cannot find name 'KeyboardEvent'.
node_modules/@angular/cdk/a11y/typings/live-announcer.d.ts(9,67): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/cdk/a11y/typings/live-announcer.d.ts(30,27): error TS2304: Cannot find name 'Document'.
node_modules/@angular/cdk/bidi/typings/directionality.d.ts(20,51): error TS2304: Cannot find name 'Document'.
node_modules/@angular/cdk/layout/typings/media-matcher.d.ts(14,32): error TS2304: Cannot find name 'MediaQueryList'.
node_modules/@angular/cdk/overlay/typings/fullscreen-overlay-container.d.ts(17,29): error TS2304: Cannot find name 'Element'.
node_modules/@angular/cdk/overlay/typings/overlay-container.d.ts(12,34): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/cdk/overlay/typings/overlay-container.d.ts(21,28): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/cdk/overlay/typings/overlay-ref.d.ts(34,29): error TS2304: Cannot find name 'KeyboardEvent'.
node_modules/@angular/cdk/overlay/typings/overlay-ref.d.ts(35,53): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/cdk/overlay/typings/overlay-ref.d.ts(37,30): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/cdk/overlay/typings/overlay-ref.d.ts(57,33): error TS2304: Cannot find name 'KeyboardEvent'.
node_modules/@angular/cdk/portal/typings/dom-portal-outlet.d.ts(19,34): error TS2304: Cannot find name 'Element'.
node_modules/@angular/cdk/scrolling/typings/viewport-ruler.d.ts(32,24): error TS2304: Cannot find name 'ClientRect'.
node_modules/@angular/cdk/scrolling/typings/viewport-ruler.d.ts(42,47): error TS2304: Cannot find name 'Event'.
node_modules/@angular/cdk/stepper/typings/stepper.d.ts(96,23): error TS2304: Cannot find name 'KeyboardEvent'.
node_modules/@angular/common/http/src/client.d.ts(62,20): error TS2304: Cannot find name 'Blob'.
node_modules/@angular/common/http/src/client.d.ts(116,30): error TS2304: Cannot find name 'Blob'.
node_modules/@angular/common/http/src/client.d.ts(206,33): error TS2304: Cannot find name 'Blob'.
node_modules/@angular/common/http/src/client.d.ts(349,20): error TS2304: Cannot find name 'Blob'.
node_modules/@angular/common/http/src/client.d.ts(400,30): error TS2304: Cannot find name 'Blob'.
node_modules/@angular/common/http/src/client.d.ts(485,33): error TS2304: Cannot find name 'Blob'.
node_modules/@angular/common/http/src/client.d.ts(604,20): error TS2304: Cannot find name 'Blob'.
node_modules/@angular/common/http/src/client.d.ts(655,30): error TS2304: Cannot find name 'Blob'.
node_modules/@angular/common/http/src/client.d.ts(740,33): error TS2304: Cannot find name 'Blob'.
node_modules/@angular/common/http/src/client.d.ts(854,20): error TS2304: Cannot find name 'Blob'.
node_modules/@angular/common/http/src/client.d.ts(905,30): error TS2304: Cannot find name 'Blob'.
node_modules/@angular/common/http/src/client.d.ts(990,33): error TS2304: Cannot find name 'Blob'.
node_modules/@angular/common/http/src/client.d.ts(1121,20): error TS2304: Cannot find name 'Blob'.
node_modules/@angular/common/http/src/client.d.ts(1172,30): error TS2304: Cannot find name 'Blob'.
node_modules/@angular/common/http/src/client.d.ts(1257,33): error TS2304: Cannot find name 'Blob'.
node_modules/@angular/common/http/src/client.d.ts(1376,20): error TS2304: Cannot find name 'Blob'.
node_modules/@angular/common/http/src/client.d.ts(1427,30): error TS2304: Cannot find name 'Blob'.
node_modules/@angular/common/http/src/client.d.ts(1512,33): error TS2304: Cannot find name 'Blob'.
node_modules/@angular/common/http/src/client.d.ts(1631,20): error TS2304: Cannot find name 'Blob'.
node_modules/@angular/common/http/src/client.d.ts(1682,30): error TS2304: Cannot find name 'Blob'.
node_modules/@angular/common/http/src/client.d.ts(1767,33): error TS2304: Cannot find name 'Blob'.
node_modules/@angular/common/http/src/client.d.ts(1886,20): error TS2304: Cannot find name 'Blob'.
node_modules/@angular/common/http/src/client.d.ts(1937,30): error TS2304: Cannot find name 'Blob'.
node_modules/@angular/common/http/src/client.d.ts(2018,33): error TS2304: Cannot find name 'Blob'.
node_modules/@angular/common/http/src/request.d.ts(89,36): error TS2304: Cannot find name 'Blob'.
node_modules/@angular/common/http/src/request.d.ts(89,43): error TS2304: Cannot find name 'FormData'.
node_modules/@angular/common/http/src/xhr.d.ts(11,23): error TS2304: Cannot find name 'XMLHttpRequest'.
node_modules/@angular/common/src/dom_tokens.d.ts(17,47): error TS2304: Cannot find name 'Document'.
node_modules/@angular/core/src/testability/testability.d.ts(91,33): error TS2304: Cannot find name 'Node'.
node_modules/@angular/forms/src/directives/ng_form.d.ts(94,22): error TS2304: Cannot find name 'Event'.
node_modules/@angular/forms/src/directives/reactive_directives/form_group_directive.d.ts(74,22): error TS2304: Cannot find name 'Event'.
node_modules/@angular/material/autocomplete/typings/autocomplete-trigger.d.ts(116,27): error TS2304: Cannot find name 'KeyboardEvent'.
node_modules/@angular/material/autocomplete/typings/autocomplete-trigger.d.ts(117,25): error TS2304: Cannot find name 'KeyboardEvent'.
node_modules/@angular/material/button-toggle/typings/button-toggle.d.ts(157,27): error TS2304: Cannot find name 'Event'.
node_modules/@angular/material/button-toggle/typings/button-toggle.d.ts(158,26): error TS2304: Cannot find name 'Event'.
node_modules/@angular/material/button/typings/button.d.ts(75,32): error TS2304: Cannot find name 'Event'.
node_modules/@angular/material/checkbox/typings/checkbox.d.ts(161,26): error TS2304: Cannot find name 'Event'.
node_modules/@angular/material/checkbox/typings/checkbox.d.ts(164,32): error TS2304: Cannot find name 'Event'.
node_modules/@angular/material/chips/typings/chip-input.d.ts(6,12): error TS2304: Cannot find name 'HTMLInputElement'.
node_modules/@angular/material/chips/typings/chip-input.d.ts(38,30): error TS2304: Cannot find name 'HTMLInputElement'.
node_modules/@angular/material/chips/typings/chip-input.d.ts(41,22): error TS2304: Cannot find name 'KeyboardEvent'.
node_modules/@angular/material/chips/typings/chip-input.d.ts(46,26): error TS2304: Cannot find name 'KeyboardEvent'.
node_modules/@angular/material/chips/typings/chip-list.d.ts(176,21): error TS2304: Cannot find name 'KeyboardEvent'.
node_modules/@angular/material/chips/typings/chip.d.ts(110,25): error TS2304: Cannot find name 'Event'.
node_modules/@angular/material/chips/typings/chip.d.ts(112,27): error TS2304: Cannot find name 'KeyboardEvent'.
node_modules/@angular/material/chips/typings/chip.d.ts(132,25): error TS2304: Cannot find name 'MouseEvent'.
node_modules/@angular/material/core/typings/gestures/gesture-annotations.d.ts(25,19): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/material/core/typings/gestures/gesture-annotations.d.ts(25,33): error TS2304: Cannot find name 'SVGElement'.
node_modules/@angular/material/core/typings/gestures/gesture-annotations.d.ts(63,19): error TS2304: Cannot find name 'EventTarget'.
node_modules/@angular/material/core/typings/gestures/gesture-config.d.ts(35,26): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/material/core/typings/option/option.d.ts(88,27): error TS2304: Cannot find name 'KeyboardEvent'.
node_modules/@angular/material/core/typings/option/option.d.ts(97,24): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/material/core/typings/ripple/ripple-ref.d.ts(21,14): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/material/core/typings/ripple/ripple-ref.d.ts(25,53): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/material/core/typings/ripple/ripple-renderer.d.ts(62,32): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/material/core/typings/ripple/ripple.d.ts(33,14): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/material/core/typings/ripple/ripple.d.ts(33,28): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/material/core/typings/style/apply-transform.d.ts(13,52): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/material/datepicker/typings/calendar.d.ts(78,39): error TS2304: Cannot find name 'KeyboardEvent'.
node_modules/@angular/material/datepicker/typings/datepicker-input.d.ts(17,20): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/material/datepicker/typings/datepicker-input.d.ts(24,24): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/material/datepicker/typings/datepicker-input.d.ts(95,23): error TS2304: Cannot find name 'KeyboardEvent'.
node_modules/@angular/material/datepicker/typings/datepicker-toggle.d.ts(17,18): error TS2304: Cannot find name 'Event'.
node_modules/@angular/material/datepicker/typings/datepicker.d.ts(41,27): error TS2304: Cannot find name 'KeyboardEvent'.
node_modules/@angular/material/dialog/typings/dialog-ref.d.ts(56,33): error TS2304: Cannot find name 'KeyboardEvent'.
node_modules/@angular/material/expansion/typings/expansion-panel-header.d.ts(33,19): error TS2304: Cannot find name 'KeyboardEvent'.
node_modules/@angular/material/form-field/typings/form-field-control.d.ts(51,38): error TS2304: Cannot find name 'MouseEvent'.
node_modules/@angular/material/icon/typings/icon-registry.d.ts(113,61): error TS2304: Cannot find name 'SVGElement'.
node_modules/@angular/material/icon/typings/icon-registry.d.ts(122,67): error TS2304: Cannot find name 'SVGElement'.
node_modules/@angular/material/list/typings/list.d.ts(65,24): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/material/list/typings/selection-list.d.ts(92,24): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/material/list/typings/selection-list.d.ts(128,21): error TS2304: Cannot find name 'KeyboardEvent'.
node_modules/@angular/material/menu/typings/menu-directive.d.ts(84,27): error TS2304: Cannot find name 'KeyboardEvent'.
node_modules/@angular/material/menu/typings/menu-item.d.ts(35,24): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/material/menu/typings/menu-item.d.ts(37,27): error TS2304: Cannot find name 'Event'.
node_modules/@angular/material/menu/typings/menu-trigger.d.ts(120,29): error TS2304: Cannot find name 'MouseEvent'.
node_modules/@angular/material/menu/typings/menu-trigger.d.ts(122,27): error TS2304: Cannot find name 'KeyboardEvent'.
node_modules/@angular/material/menu/typings/menu-trigger.d.ts(124,25): error TS2304: Cannot find name 'MouseEvent'.
node_modules/@angular/material/radio/typings/radio.d.ts(208,26): error TS2304: Cannot find name 'Event'.
node_modules/@angular/material/radio/typings/radio.d.ts(213,27): error TS2304: Cannot find name 'Event'.
node_modules/@angular/material/select/typings/select.d.ts(106,19): error TS2304: Cannot find name 'ClientRect'.
node_modules/@angular/material/select/typings/select.d.ts(271,27): error TS2304: Cannot find name 'KeyboardEvent'.
node_modules/@angular/material/sidenav/typings/drawer.d.ts(146,26): error TS2304: Cannot find name 'KeyboardEvent'.
node_modules/@angular/material/slide-toggle/typings/slide-toggle.d.ts(67,27): error TS2304: Cannot find name 'Event'.
node_modules/@angular/material/slide-toggle/typings/slide-toggle.d.ts(69,26): error TS2304: Cannot find name 'Event'.
node_modules/@angular/material/slider/typings/slider.d.ts(146,21): error TS2304: Cannot find name 'MouseEvent'.
node_modules/@angular/material/slider/typings/slider.d.ts(152,23): error TS2304: Cannot find name 'KeyboardEvent'.
node_modules/@angular/material/tabs/typings/ink-bar.d.ts(22,29): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/material/tabs/typings/tab-header.d.ts(70,27): error TS2304: Cannot find name 'KeyboardEvent'.
node_modules/@angular/material/tooltip/typings/tooltip.d.ts(89,23): error TS2304: Cannot find name 'KeyboardEvent'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(11,26): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(12,21): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(13,21): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(14,16): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(21,23): error TS2304: Cannot find name 'Element'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(23,12): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(24,21): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(25,23): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(26,42): error TS2304: Cannot find name 'MouseEvent'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(27,34): error TS2304: Cannot find name 'Event'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(28,25): error TS2304: Cannot find name 'Event'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(29,22): error TS2304: Cannot find name 'Event'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(30,22): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(31,28): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(31,35): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(32,22): error TS2304: Cannot find name 'HTMLElement'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(33,20): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(34,21): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(35,16): error TS2304: Cannot find name 'HTMLInputElement'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(36,19): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(36,26): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(37,20): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(37,27): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(38,21): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(38,28): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(39,23): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(39,30): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(40,26): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(41,26): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(42,20): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(43,21): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(43,33): error TS2304: Cannot find name 'Node'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(44,21): error TS2304: Cannot find name 'Node'.
ETC...

Dependencies of my Angular project:

"dependencies": {
    "@angular/animations": "^5.1.2",
    "@angular/cdk": "5.0.2",
    "@angular/common": "^5.1.2",
    "@angular/compiler": "^5.1.2",
    "@angular/core": "^5.1.2",
    "@angular/flex-layout": "2.0.0-beta.12",
    "@angular/forms": "^5.1.2",
    "@angular/http": "^5.1.2",
    "@angular/material": "5.0.2",
    "@angular/platform-browser": "^5.1.2",
    "@angular/platform-browser-dynamic": "^5.1.2",
    "@angular/platform-server": "^5.1.2",
    "@angular/router": "^5.1.2",
    "@covalent/core": "1.0.0-rc.1",
    "@covalent/dynamic-forms": "1.0.0-rc.1",
    "@covalent/highlight": "1.0.0-rc.1",
    "@covalent/http": "1.0.0-rc.1",
    "@covalent/markdown": "1.0.0-rc.1",
    "@ng-bootstrap/ng-bootstrap": "^1.1.2",
    "@swimlane/ngx-charts": "^7.0.1",
    "codemirror": "^5.22.2",
    "core-js": "^2.4.1",
    "d3": "^4.12.2",
    "ecstatic": "^3.1.1",
    "hammerjs": "^2.0.8",
    "highlight.js": "9.12.0",
    "line-diff": "^2.0.0",
    "ng2-breadcrumbs": "^0.1.281",
    "ng2-codemirror": "1.1.3",
    "rich-text-diff": "^0.2.3",
    "rxjs": "^5.2.0",
    "showdown": "1.8.6",
    "ssri": "^5.3.0",
    "zone.js": "^0.8.19"
  },
  "devDependencies": {
    "@angular/cli": "^1.6.3",
    "@angular/compiler-cli": "^5.1.2",
    "@angular/language-service": "^5.1.2",
    "@types/jasmine": "~2.8.3",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "^8.5.8",
    "codelyzer": "~4.0.2",
    "coveralls": "^3.0.0",
    "http-server": "0.10.x",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~2.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.3.3",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.2.2",
    "ts-node": "~4.1.0",
    "tslint": "~5.8.0",
    "typescript": "^2.5.3"
  }

The fact is that when I run 'ng serve', I don't view any error, but when I try to run the tests I receive those errors.

Without solving this error I can't run and test my tests so what am I doing wrong?

Aucun commentaire:

Enregistrer un commentaire