【问题标题】:Angular build errors角度构建错误
【发布时间】:2017-12-01 03:44:40
【问题描述】:

请告诉我发生了什么事。 构建项目时遇到以下错误。已经尝试删除typings, angular,, 目录,然后在没有更改的情况下进行typings install。 他发誓要安装的所有软件包。得到以下错误:

app/app.module.ts(1,10): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/core/index"' has no exported member 'NgModule'.
    app/app.module.ts(2,10): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/platform-browser/index"' has no exported member 'BrowserModule'.
    app/app.module.ts(3,10): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/router/index"' has no exported member 'RouterModule'.
    app/app.module.ts(10,24): error TS2307: Cannot find module './app.routes'.
    app/app.route.ts(1,10): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/router/index"' has no exported member 'Routes'.
    app/main.ts(1,10): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/platform-browser-dynamic/index"' has no exported member 'platformBrowserDynamic'.
    app/main.ts(3,27): error TS2307: Cannot find module './app/app.module'.
    node_modules/@angular/flex-layout/flexbox/_module.d.ts(10,10): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/core/index"' has no exported member 'ModuleWithProviders'.
    node_modules/@angular/flex-layout/flexbox/api/base-adapter.d.ts(8,22): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/core/index"' has no exported member 'Renderer2'.
    node_modules/@angular/flex-layout/flexbox/api/base.d.ts(8,22): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/core/index"' has no exported member 'Renderer2'.
    node_modules/@angular/flex-layout/media-query/breakpoints/break-points-provider.d.ts(8,10): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/core/index"' has no exported member 'InjectionToken'.
    node_modules/@angular/flex-layout/media-query/breakpoints/break-points-token.d.ts(8,10): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/core/index"' has no exported member 'InjectionToken'.
    node_modules/@angular/flex-layout/media-query/media-monitor-provider.d.ts(21,60): error TS2304: Cannot find name 'Optional'.
    node_modules/@angular/flex-layout/media-query/observable-media-provider.d.ts(23,60): error TS2304: Cannot find name 'Optional'.
    node_modules/@angular/material/typings/button-toggle/button-toggle.d.ts(8,22): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/core/index"' has no exported member 'Renderer2'.
    node_modules/@angular/material/typings/button/button.d.ts(8,33): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/core/index"' has no exported member 'Renderer2'.
    node_modules/@angular/material/typings/checkbox/checkbox.d.ts(8,81): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/core/index"' has no exported member 'Renderer2'.
    node_modules/@angular/material/typings/chips/chip.d.ts(8,47): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/core/index"' has no exported member 'Renderer2'.
    node_modules/@angular/material/typings/core/a11y/live-announcer.d.ts(8,10): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/core/index"' has no exported member 'InjectionToken'.
    node_modules/@angular/material/typings/core/a11y/live-announcer.d.ts(29,30): error TS2304: Cannot find name 'Optional'.
    node_modules/@angular/material/typings/core/line/line.d.ts(8,10): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/core/index"' has no exported member 'Renderer2'.
    node_modules/@angular/material/typings/core/overlay/overlay-container.d.ts(36,11): error TS2304: Cannot find name 'Optional'.
    node_modules/@angular/material/typings/core/overlay/overlay-directives.d.ts(8,78): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/core/index"' has no exported member 'Renderer2'.
    node_modules/@angular/material/typings/core/overlay/position/viewport-ruler.d.ts(34,38): error TS2304: Cannot find name 'Optional'.
    node_modules/@angular/material/typings/core/overlay/scroll/scroll-dispatcher.d.ts(64,30): error TS2304: Cannot find name 'Optional'.
    node_modules/@angular/material/typings/core/ripple/ripple.d.ts(8,67): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/core/index"' has no exported member 'InjectionToken'.
    node_modules/@angular/material/typings/core/style/focus-origin-monitor.d.ts(8,65): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/core/index"' has no exported member 'Renderer2'.
    node_modules/@angular/material/typings/core/style/focus-origin-monitor.d.ts(102,30): error TS2304: Cannot find name 'Optional'.
    node_modules/@angular/material/typings/datepicker/datepicker-input.d.ts(8,65): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/core/index"' has no exported member 'Renderer2'.
    node_modules/@angular/material/typings/datepicker/datepicker-input.d.ts(10,49): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/forms/index"' has no exported member 'ValidationErrors'.
    node_modules/@angular/material/typings/dialog/dialog-container.d.ts(9,32): error TS2307: Cannot find module '@angular/animations'.
    node_modules/@angular/material/typings/dialog/dialog-injector.d.ts(8,20): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/core/index"' has no exported member 'InjectionToken'.
    node_modules/@angular/material/typings/grid-list/grid-list.d.ts(8,50): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/core/index"' has no exported member 'Renderer2'.
    node_modules/@angular/material/typings/grid-list/grid-tile.d.ts(8,10): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/core/index"' has no exported member 'Renderer2'.
    node_modules/@angular/material/typings/icon/icon-registry.d.ts(9,27): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/platform-browser/index"' has no exported member 'DomSanitizer'.
    node_modules/@angular/material/typings/menu/menu-animations.d.ts(8,42): error TS2307: Cannot find module '@angular/animations'.
    node_modules/@angular/material/typings/progress-spinner/progress-spinner.d.ts(8,41): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/core/index"' has no exported member 'Renderer2'.
    node_modules/@angular/material/typings/radio/radio.d.ts(8,59): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/core/index"' has no exported member 'Renderer2'.
    node_modules/@angular/material/typings/select/select-animations.d.ts(8,42): error TS2307: Cannot find module '@angular/animations'.
    node_modules/@angular/material/typings/slide-toggle/slide-toggle.d.ts(8,84): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/core/index"' has no exported member 'Renderer2'.
    node_modules/@angular/material/typings/slider/slider.d.ts(8,47): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/core/index"' has no exported member 'Renderer2'.
    node_modules/@angular/material/typings/snack-bar/snack-bar-container.d.ts(8,43): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/core/index"' has no exported member 'Renderer2'.
    node_modules/@angular/material/typings/snack-bar/snack-bar-container.d.ts(9,32): error TS2307: Cannot find module '@angular/animations'.
    node_modules/@angular/material/typings/tabs/ink-bar.d.ts(8,10): error TS2305: Module '"/home/nikita/django-ng2-starter/ngApp/node_modules/@angular/core/index"' has no exported member 'Renderer2'.
    node_modules/@angular/material/typings/tabs/tab-body.d.ts(9,32): error TS2307: Cannot find module '@angular/animations'.
    node_modules/@angular/material/typings/tooltip/tooltip.d.ts(9,32): error TS2307: Cannot find module '@angular/animations'.
    node_modules/@types/jasmine/index.d.ts(181,15): error TS2428: All declarations of 'ObjectContaining' must have identical type parameters.
    node_modules/@types/jasmine/index.d.ts(212,10): error TS2300: Duplicate identifier 'CustomEqualityTester'.
    node_modules/@types/node/index.d.ts(70,5): error TS2403: Subsequent variable declarations must have the same type.  Variable 'main' must be of type 'any', but here has type 'NodeModule'.
    node_modules/@types/node/index.d.ts(81,5): error TS2403: Subsequent variable declarations must have the same type.  Variable 'parent' must be of type 'any', but here has type 'NodeModule'.
    node_modules/@types/node/index.d.ts(82,5): error TS2403: Subsequent variable declarations must have the same type.  Variable 'children' must be of type 'any[]', but here has type 'NodeModule[]'.
    node_modules/@types/node/index.d.ts(102,6): error TS2300: Duplicate identifier 'BufferEncoding'.
    node_modules/@types/node/index.d.ts(378,9): error TS2403: Subsequent variable declarations must have the same type.  Variable 'stdout' must be of type 'WritableStream', but here has type 'WriteStream'.
    node_modules/@types/node/index.d.ts(430,9): error TS2403: Subsequent variable declarations must have the same type.  Variable 'platform' must be of type 'string', but here has type 'Platform'.
    node_modules/@types/node/index.d.ts(588,26): error TS2300: Duplicate identifier 'Buffer'.
    node_modules/@types/node/index.d.ts(588,50): error TS2300: Duplicate identifier 'SlowBuffer'.
    node_modules/@types/node/index.d.ts(632,5): error TS2309: An export assignment cannot be used in a module with other exported elements.
    node_modules/@types/node/index.d.ts(777,18): error TS2300: Duplicate identifier 'Agent'.
    node_modules/@types/node/index.d.ts(832,9): error TS2403: Subsequent variable declarations must have the same type.  Variable 'addressType' must be of type 'string', but here has type 'number | "udp4" | "udp6"'.
    node_modules/@types/node/index.d.ts(835,18): error TS2300: Duplicate identifier 'Worker'.
    node_modules/@types/node/index.d.ts(1316,9): error TS2403: Subsequent variable declarations must have the same type.  Variable 'SNICallback' must be of type '(servername: string) => any', but here has type '(servername: string, cb: (err: Error, ctx: SecureContext) => any) => any'.
    node_modules/@types/node/index.d.ts(1518,17): error TS2300: Duplicate identifier 'CompleterResult'.
    node_modules/@types/node/index.d.ts(1555,18): error TS2300: Duplicate identifier 'Script'.
    node_modules/@types/node/index.d.ts(2880,16): error TS2403: Subsequent variable declarations must have the same type.  Variable 'StringDecoder' must be of type 'new (encoding: string) => NodeStringDecoder', but here has type 'new (encoding?: string) => NodeStringDecoder'.
    node_modules/@types/node/index.d.ts(2931,18): error TS2300: Duplicate identifier 'TLSSocket'.
    node_modules/@types/node/index.d.ts(3128,9): error TS2403: Subsequent variable declarations must have the same type.  Variable 'pfx' must be of type 'any', but here has type 'string | Buffer[]'.
    node_modules/@types/node/index.d.ts(3155,9): error TS2403: Subsequent variable declarations must have the same type.  Variable 'key' must be of type 'string | Buffer', but here has type 'string | string[] | Buffer | Buffer[]'.
    node_modules/@types/node/index.d.ts(3157,9): error TS2403: Subsequent variable declarations must have the same type.  Variable 'cert' must be of type 'string | Buffer', but here has type 'string | string[] | Buffer | Buffer[]'.
    node_modules/@types/node/index.d.ts(3158,9): error TS2403: Subsequent variable declarations must have the same type.  Variable 'ca' must be of type '(string | Buffer)[]', but here has type 'string | Buffer | (string | Buffer)[]'.
    node_modules/@types/node/index.d.ts(3397,9): error TS2403: Subsequent variable declarations must have the same type.  Variable 'padding' must be of type 'any', but here has type 'number'.
    node_modules/@types/node/index.d.ts(3642,5): error TS2309: An export assignment cannot be used in a module with other exported elements.
    node_modules/@types/node/index.d.ts(3719,5): error TS2300: Duplicate identifier 'export='.
    node_modules/rxjs/Subject.d.ts(9,22): error TS2415: Class 'Subject<T>' incorrectly extends base class 'Observable<T>'.
      Types of property 'lift' are incompatible.
        Type '<T, R>(operator: Operator<T, R>) => Observable<T>' is not assignable to type '<R>(operator: Operator<T, R>) => Observable<R>'.
          Type 'Observable<T>' is not assignable to type 'Observable<R>'.
            Type 'T' is not assignable to type 'R'.
    node_modules/typescript/lib/lib.es2015.collection.d.ts(45,11): error TS2428: All declarations of 'WeakMap' must have identical type parameters.
    node_modules/typescript/lib/lib.es2015.core.d.ts(21,14): error TS2300: Duplicate identifier 'PropertyKey'.
    node_modules/typescript/lib/lib.es2015.iterable.d.ts(157,11): error TS2428: All declarations of 'WeakMap' must have identical type parameters.
    node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts(133,11): error TS2428: All declarations of 'WeakMap' must have identical type parameters.
    typings/globals/core-js/index.d.ts(3,14): error TS2300: Duplicate identifier 'PropertyKey'.
    typings/globals/core-js/index.d.ts(40,5): error TS2687: All declarations of 'name' must have identical modifiers.
    typings/globals/core-js/index.d.ts(100,5): error TS2403: Subsequent variable declarations must have the same type.  Variable '[Symbol.unscopables]' must be of type '{ copyWithin: boolean; entries: boolean; fill: boolean; find: boolean; findIndex: boolean; keys: ...', but here has type 'any'.
    typings/globals/core-js/index.d.ts(217,5): error TS2687: All declarations of 'flags' must have identical modifiers.
    typings/globals/core-js/index.d.ts(231,5): error TS2687: All declarations of 'EPSILON' must have identical modifiers.
    typings/globals/core-js/index.d.ts(266,5): error TS2687: All declarations of 'MAX_SAFE_INTEGER' must have identical modifiers.
    typings/globals/core-js/index.d.ts(273,5): error TS2687: All declarations of 'MIN_SAFE_INTEGER' must have identical modifiers.
    typings/globals/core-js/index.d.ts(412,5): error TS2403: Subsequent variable declarations must have the same type.  Variable '[Symbol.toStringTag]' must be of type '"Symbol"', but here has type 'string'.
    typings/globals/core-js/index.d.ts(412,5): error TS2687: All declarations of '[Symbol.toStringTag]' must have identical modifiers.
    typings/globals/core-js/index.d.ts(419,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
    typings/globals/core-js/index.d.ts(600,5): error TS2687: All declarations of 'size' must have identical modifiers.
    typings/globals/core-js/index.d.ts(606,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
    typings/globals/core-js/index.d.ts(611,11): error TS2428: All declarations of 'WeakMap' must have identical type parameters.
    typings/globals/core-js/index.d.ts(619,27): error TS2344: Type 'K' does not satisfy the constraint 'object'.
    typings/globals/core-js/index.d.ts(620,53): error TS2344: Type 'K' does not satisfy the constraint 'object'.
    typings/globals/core-js/index.d.ts(621,5): error TS2403: Subsequent variable declarations must have the same type.  Variable 'prototype' must be of type 'WeakMap<object, any>', but here has type 'WeakMap<any, any>'.
    typings/globals/core-js/index.d.ts(621,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
    typings/globals/core-js/index.d.ts(635,5): error TS2403: Subsequent variable declarations must have the same type.  Variable 'prototype' must be of type 'WeakSet<object>', but here has type 'WeakSet<any>'.
    typings/globals/core-js/index.d.ts(635,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
    typings/globals/core-js/index.d.ts(647,5): error TS2687: All declarations of 'value' must have identical modifiers.
    typings/globals/jasmine/index.d.ts(84,15): error TS2428: All declarations of 'ObjectContaining' must have identical type parameters.
    typings/globals/jasmine/index.d.ts(114,15): error TS2300: Duplicate identifier 'CustomEqualityTester'.
    typings/globals/jasmine/index.d.ts(123,15): error TS2300: Duplicate identifier 'CustomMatcherFactory'.
    typings/globals/jasmine/index.d.ts(128,9): error TS2374: Duplicate string index signature.
    typings/globals/jasmine/index.d.ts(151,24): error TS2314: Generic type 'Matchers<T>' requires 1 type argument(s).
    typings/globals/jasmine/index.d.ts(274,15): error TS2428: All declarations of 'Matchers' must have identical type parameters.
    typings/globals/jasmine/index.d.ts(279,9): error TS2403: Subsequent variable declarations must have the same type.  Variable 'actual' must be of type 'T', but here has type 'any'.
    typings/globals/jasmine/index.d.ts(303,14): error TS2314: Generic type 'Matchers<T>' requires 1 type argument(s).
    typings/globals/jasmine/index.d.ts(339,15): error TS2300: Duplicate identifier 'SpecFunction'.
    typings/globals/jasmine/index.d.ts(360,24): error TS2314: Generic type 'Matchers<T>' requires 1 type argument(s).
    typings/globals/jasmine/index.d.ts(372,30): error TS2314: Generic type 'Matchers<T>' requires 1 type argument(s).
    typings/globals/node/index.d.ts(78,6): error TS2300: Duplicate identifier 'BufferEncoding'.
    typings/globals/node/index.d.ts(503,9): error TS2502: 'BuffType' is referenced directly or indirectly in its own type annotation.
    typings/globals/node/index.d.ts(504,9): error TS2502: 'SlowBuffType' is referenced directly or indirectly in its own type annotation.
    typings/globals/node/index.d.ts(505,26): error TS2300: Duplicate identifier 'Buffer'.
    typings/globals/node/index.d.ts(567,22): error TS2320: Interface 'Server' cannot simultaneously extend types 'EventEmitter' and 'Server'.
      Named property 'addListener' of types 'EventEmitter' and 'Server' are not identical.
    typings/globals/node/index.d.ts(567,22): error TS2320: Interface 'Server' cannot simultaneously extend types 'EventEmitter' and 'Server'.
      Named property 'emit' of types 'EventEmitter' and 'Server' are not identical.
    typings/globals/node/index.d.ts(567,22): error TS2320: Interface 'Server' cannot simultaneously extend types 'EventEmitter' and 'Server'.
      Named property 'prependOnceListener' of types 'EventEmitter' and 'Server' are not identical.
    typings/globals/node/index.d.ts(567,22): error TS2320: Interface 'Server' cannot simultaneously extend types 'EventEmitter' and 'Server'.
      Named property 'removeListener' of types 'EventEmitter' and 'Server' are not identical.
    typings/globals/node/index.d.ts(578,22): error TS2320: Interface 'ServerResponse' cannot simultaneously extend types 'EventEmitter' and 'Writable'.
      Named property 'addListener' of types 'EventEmitter' and 'Writable' are not identical.
    typings/globals/node/index.d.ts(578,22): error TS2320: Interface 'ServerResponse' cannot simultaneously extend types 'EventEmitter' and 'Writable'.
      Named property 'emit' of types 'EventEmitter' and 'Writable' are not identical.
    typings/globals/node/index.d.ts(578,22): error TS2320: Interface 'ServerResponse' cannot simultaneously extend types 'EventEmitter' and 'Writable'.
      Named property 'once' of types 'EventEmitter' and 'Writable' are not identical.
    typings/globals/node/index.d.ts(578,22): error TS2320: Interface 'ServerResponse' cannot simultaneously extend types 'EventEmitter' and 'Writable'.
      Named property 'prependListener' of types 'EventEmitter' and 'Writable' are not identical.
    typings/globals/node/index.d.ts(578,22): error TS2320: Interface 'ServerResponse' cannot simultaneously extend types 'EventEmitter' and 'Writable'.
      Named property 'prependOnceListener' of types 'EventEmitter' and 'Writable' are not identical.
    typings/globals/node/index.d.ts(578,22): error TS2320: Interface 'ServerResponse' cannot simultaneously extend types 'EventEmitter' and 'Writable'.
      Named property 'removeListener' of types 'EventEmitter' and 'Writable' are not identical.
    typings/globals/node/index.d.ts(606,22): error TS2320: Interface 'ClientRequest' cannot simultaneously extend types 'EventEmitter' and 'Writable'.
      Named property 'addListener' of types 'EventEmitter' and 'Writable' are not identical.
    typings/globals/node/index.d.ts(606,22): error TS2320: Interface 'ClientRequest' cannot simultaneously extend types 'EventEmitter' and 'Writable'.
      Named property 'emit' of types 'EventEmitter' and 'Writable' are not identical.
    typings/globals/node/index.d.ts(606,22): error TS2320: Interface 'ClientRequest' cannot simultaneously extend types 'EventEmitter' and 'Writable'.
      Named property 'on' of types 'EventEmitter' and 'Writable' are not identical.
    typings/globals/node/index.d.ts(606,22): error TS2320: Interface 'ClientRequest' cannot simultaneously extend types 'EventEmitter' and 'Writable'.
      Named property 'once' of types 'EventEmitter' and 'Writable' are not identical.
    typings/globals/node/index.d.ts(606,22): error TS2320: Interface 'ClientRequest' cannot simultaneously extend types 'EventEmitter' and 'Writable'.
      Named property 'prependListener' of types 'EventEmitter' and 'Writable' are not identical.
    typings/globals/node/index.d.ts(606,22): error TS2320: Interface 'ClientRequest' cannot simultaneously extend types 'EventEmitter' and 'Writable'.
    typings/globals/node/index.d.ts(632,22): error TS2320: Interface 'IncomingMessage' cannot simultaneously extend types 'EventEmitter' and 'Readable'.
      Named property 'on' of types 'EventEmitter' and 'Readable' are not identical.
    typings/globals/node/index.d.ts(632,22): error TS2320: Interface 'IncomingMessage' cannot simultaneously extend types 'EventEmitter' and 'Readable'.
      Named property 'once' of types 'EventEmitter' and 'Readable' are not identical.
    typings/globals/node/index.d.ts(632,22): error TS2320: Interface 'IncomingMessage' cannot simultaneously extend types 'EventEmitter' and 'Readable'.
      Named property 'prependListener' of types 'EventEmitter' and 'Readable' are not identical.
    typings/globals/node/index.d.ts(632,22): error TS2320: Interface 'IncomingMessage' cannot simultaneously extend types 'EventEmitter' and 'Readable'.
      Named property 'prependOnceListener' of types 'EventEmitter' and 'Readable' are not identical.
    typings/globals/node/index.d.ts(632,22): error TS2320: Interface 'IncomingMessage' cannot simultaneously extend types 'EventEmitter' and 'Readable'.
      Named property 'removeListener' of types 'EventEmitter' and 'Readable' are not identical.
    typings/globals/node/index.d.ts(682,18): error TS2300: Duplicate identifier 'Agent'.
    typings/globals/node/index.d.ts(727,18): error TS2300: Duplicate identifier 'Worker'.
    typings/globals/node/index.d.ts(980,22): error TS2300: Duplicate identifier 'CompleterResult'.
    typings/globals/node/index.d.ts(1020,18): error TS2300: Duplicate identifier 'Script'.
    typings/globals/node/index.d.ts(1247,22): error TS2430: Interface 'Socket' incorrectly extends interface 'Duplex'.
    typings/globals/node/index.d.ts(1247,22): error TS2430: Interface 'Socket' incorrectly extends interface 'Duplex'.
      Types of property 'pause' are incompatible.
        Type '() => void' is not assignable to type '() => this'.
          Type 'void' is not assignable to type 'this'.
    typings/globals/node/index.d.ts(1298,22): error TS2320: Interface 'Server' cannot simultaneously extend types 'Socket' and 'EventEmitter'.
      Named property 'removeListener' of types 'Socket' and 'EventEmitter' are not identical.
    typings/globals/node/index.d.ts(1861,18): error TS2300: Duplicate identifier 'TLSSocket'.
    typings/globals/node/index.d.ts(2159,18): error TS2420: Class 'Readable' incorrectly implements interface 'ReadableStream'.
      Types of property 'pause' are incompatible.
        Type '() => void' is not assignable to type '{ (): void; (): this; }'.
          Type 'void' is not assignable to type 'this'.
    typings/globals/node/index.d.ts(2196,18): error TS2420: Class 'Duplex' incorrectly implements interface 'ReadWriteStream'.
      Types of property 'pause' are incompatible.
        Type '() => void' is not assignable to type '{ (): void; (): this; }'.
          Type 'void' is not assignable to type 'this'.
    typings/globals/node/index.d.ts(2210,18): error TS2420: Class 'Transform' incorrectly implements interface 'ReadWriteStream'.
      Types of property 'pause' are incompatible.
        Type '() => void' is not assignable to type '{ (): void; (): this; }'.

包.json

{
  "name": "angular-quickstart",
  "version": "1.0.0",
  "description": "QuickStart package.json from the documentation, supplemented with testing support",
  "scripts": {
    "start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",
    "docker-build": "docker build -t ng2-quickstart .",
    "docker": "npm run docker-build && docker run -it --rm -p 3000:3000 -p 3001:3001 ng2-quickstart",
    "pree2e": "npm run webdriver:update",
    "e2e": "tsc && concurrently \"http-server -s\" \"protractor protractor.config.js\" --kill-others --success first",
    "lint": "tslint ./app/**/*.ts -t verbose",
    "lite": "lite-server",
    "postinstall": "typings install",
    "test": "tsc && concurrently \"tsc -w\" \"karma start karma.conf.js\"",
    "test-once": "tsc && karma start karma.conf.js --single-run",
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "typings": "typings",
    "webdriver:update": "webdriver-manager update"
  },
  "keywords": [],
  "author": "",
  "license": "MIT",
  "dependencies": {
    "@angular/animations": "^4.2.4",
    "@angular/common": "~4.0.0",
    "@angular/compiler": "~4.0.0",
    "@angular/core": "~4.0.0",
    "@angular/forms": "~4.0.0",
    "@angular/http": "~4.0.0",
    "@angular/material": "^2.0.0-beta.7",
    "@angular/platform-browser": "~4.0.0",
    "@angular/platform-browser-dynamic": "~4.0.0",
    "@angular/router": "~4.0.0",
    "@types/q": "^1.0.1",
    "angular": "^1.6.4",
    "angular-animate": "^1.6.4",
    "angular-aria": "^1.6.4",
    "angular-in-memory-web-api": "~0.3.0",
    "angular-material": "^1.1.4",
    "core-js": "^2.4.1",
    "hammerjs": "^2.0.8",
    "material": "^0.1.1",
    "rxjs": "5.0.1",
    "systemjs": "0.19.40",
    "typescript": "^2.4.1",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "@angular/flex-layout": "^2.0.0-beta.8",
    "@types/hammerjs": "^2.0.34",
    "@types/jasmine": "^2.5.53",
    "@types/node": "^6.0.78",
    "canonical-path": "0.0.2",
    "concurrently": "^3.2.0",
    "jasmine-core": "~2.4.1",
    "karma": "^1.3.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "lite-server": "^2.2.2",
    "lodash": "^4.16.4",
    "protractor": "~4.0.14",
    "rimraf": "^2.5.4",
    "tslint": "^3.15.1"
  },
  "repository": {}
}

【问题讨论】:

  • 那么,当您同时使用 AngularJS 1.x.x 和 Angular 时,您有什么期望?
  • 你有什么版本的 npm?
  • @Edric 但是我没用,不小心安装了
  • 我删除了 node_modules 文件夹并重新安装了它——一切正常。结果又拿了一个开始的项目,有了这个以后就有问题了。

标签: angularjs node.js angular npm


【解决方案1】:

您似乎有很多事情要做,首先,rxjs 和最新的 typescript 版本存在一个已知问题(2.4.1 应该可以工作,所以将您的 package.json 固定到该问题或执行 what I suggest in the issue)。

另外,请确保 @types/node 与您正在运行的节点版本匹配。 npm install --save-dev @types/node 应该更新它。

其中一些错误可能是因为将不兼容的软件包放在一起。我建议销毁你的 package.json、package-lock.json 和 node_modules 文件夹,然后逐步npm installing 只需要你的应用程序获取它们的最新版本。 (并对 rxjs + typescript 2.4.x 进行链接修复)

【讨论】:

    【解决方案2】:

    我遇到了类似的错误。将我的打字稿错误从 "typescript": "^2.4.1" 更改为 "typescript": "2.2.1" ,错误消失了。

    【讨论】:

      【解决方案3】:

      您的错误是由 Typescript 2.4 中的编译错误引起的(请参阅 Typescript 2.4 RxJS bug

      解决方案是将package.json 文件中的"typescript": "^2.4.1" 更改为"typescript": "2.3.4" 并重建您的项目。

      我在 Ionic 项目中遇到了类似的错误,这个修复对我有用。

      【讨论】:

        【解决方案4】:

        您的 npm 安装似乎已损坏。删除 node_modules 目录并再次运行 npm install。

        【讨论】:

          猜你喜欢
          • 2019-01-28
          • 2019-01-05
          • 1970-01-01
          • 2023-01-26
          • 1970-01-01
          • 1970-01-01
          • 2018-10-07
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多