2016-10-06 6 views
7

मैं एक कोणीय 2 प्रोजेक्ट पर काम कर रहा हूं और अचानक जब मैंने टाइपस्क्रिप्ट कंपाइलर को आजमाया और चलाया तो अचानक मुझे बहुत सारी त्रुटियां मिलनी शुरू हो गईं। क्या कोई सलाह दे सकता है कि खोज कहां से शुरू करें? मैंने जानबूझकर कुछ भी मूलभूत नहीं बदला है और यहां तक ​​कि जब मैं भंडार से एक नई प्रतिलिपि क्लोन करता हूं तो त्रुटियां बनी रहती हैं। त्रुटियां नीचे दी गई हैं:टाइपस्क्रिप्ट कंपाइलर अचानक त्रुटियों को उत्पन्न करना शुरू कर दिया

node_modules/@types/node/index.d.ts(102,6): error TS2300: Duplicate identifier 'BufferEncoding'. 
node_modules/@types/node/index.d.ts(256,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'errno' must be of type 'number', but here has type 'string'. 
node_modules/@types/node/index.d.ts(263,18): error TS2300: Duplicate identifier 'EventEmitter'. 
node_modules/@types/node/index.d.ts(549,26): error TS2300: Duplicate identifier 'Buffer'. 
node_modules/@types/node/index.d.ts(549,50): error TS2300: Duplicate identifier 'SlowBuffer'. 
node_modules/@types/node/index.d.ts(570,18): error TS2300: Duplicate identifier 'EventEmitter'. 
node_modules/@types/node/index.d.ts(570,18): error TS2415: Class 'EventEmitter' incorrectly extends base class 'NodeJS.EventEmitter'. 
    Types of property 'eventNames' are incompatible. 
    Type '() => (string | symbol)[]' is not assignable to type '() => string[]'. 
     Type '(string | symbol)[]' is not assignable to type 'string[]'. 
     Type 'string | symbol' is not assignable to type 'string'. 
      Type 'symbol' is not assignable to type 'string'. 
node_modules/@types/node/index.d.ts(733,18): error TS2300: Duplicate identifier 'Agent'. 
node_modules/@types/node/index.d.ts(788,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(791,18): error TS2300: Duplicate identifier 'Worker'. 
node_modules/@types/node/index.d.ts(1377,17): error TS2300: Duplicate identifier 'CompleterResult'. 
node_modules/@types/node/index.d.ts(1414,18): error TS2300: Duplicate identifier 'Script'. 
node_modules/@types/node/index.d.ts(2550,18): error TS2300: Duplicate identifier 'TLSSocket'. 
node_modules/@types/node/index.d.ts(2684,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(2685,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'key' must be of type 'any', but here has type 'string | any[] | string[] | Buffer'. 
node_modules/@types/node/index.d.ts(2687,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'cert' must be of type 'any', but here has type 'string | string[] | Buffer | Buffer[]'. 
node_modules/@types/node/index.d.ts(2688,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'ca' must be of type 'any', but here has type 'string | string[] | Buffer | Buffer[]'. 
node_modules/@types/node/index.d.ts(2689,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'crl' must be of type 'any', but here has type 'string | string[]'. 
node_modules/@types/node/index.d.ts(2691,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'honorCipherOrder' must be of type 'any', but here has type 'boolean'. 
node_modules/@types/node/index.d.ts(2694,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'NPNProtocols' must be of type 'any', but here has type 'string[] | Buffer'. 
node_modules/@types/node/index.d.ts(2711,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(2713,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(2714,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(2953,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(2958,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(3216,5): error TS2309: An export assignment cannot be used in a module with other exported elements. 
node_modules/@types/node/index.d.ts(3299,5): error TS2300: Duplicate identifier 'export='. 
node_modules/@types/node/index.d.ts(3321,18): error TS2300: Duplicate identifier 'Domain'. 
node_modules/@types/node/index.d.ts(3613,5): error TS2300: Duplicate identifier 'export='. 
typings/globals/node/index.d.ts(78,6): error TS2300: Duplicate identifier 'BufferEncoding'. 
typings/globals/node/index.d.ts(234,18): error TS2300: Duplicate identifier 'EventEmitter'. 
typings/globals/node/index.d.ts(516,9): error TS2502: 'BuffType' is referenced directly or indirectly in its own type annotation. 
typings/globals/node/index.d.ts(517,9): error TS2502: 'SlowBuffType' is referenced directly or indirectly in its own type annotation. 
typings/globals/node/index.d.ts(518,26): error TS2300: Duplicate identifier 'Buffer'. 
typings/globals/node/index.d.ts(518,50): error TS2300: Duplicate identifier 'SlowBuffer'. 
typings/globals/node/index.d.ts(539,18): error TS2300: Duplicate identifier 'EventEmitter'. 
typings/globals/node/index.d.ts(580,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(580,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(580,22): error TS2320: Interface 'Server' cannot simultaneously extend types 'EventEmitter' and 'Server'. 
    Named property 'on' of types 'EventEmitter' and 'Server' are not identical. 
typings/globals/node/index.d.ts(580,22): error TS2320: Interface 'Server' cannot simultaneously extend types 'EventEmitter' and 'Server'. 
    Named property 'once' of types 'EventEmitter' and 'Server' are not identical. 
typings/globals/node/index.d.ts(580,22): error TS2320: Interface 'Server' cannot simultaneously extend types 'EventEmitter' and 'Server'. 
    Named property 'prependListener' of types 'EventEmitter' and 'Server' are not identical. 
typings/globals/node/index.d.ts(580,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(580,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(591,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(591,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(591,22): error TS2320: Interface 'ServerResponse' cannot simultaneously extend types 'EventEmitter' and 'Writable'. 
    Named property 'on' of types 'EventEmitter' and 'Writable' are not identical. 
typings/globals/node/index.d.ts(591,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(591,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(591,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(591,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(621,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(621,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(621,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(621,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(621,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(621,22): error TS2320: Interface 'ClientRequest' cannot simultaneously extend types 'EventEmitter' and 'Writable'. 
    Named property 'prependOnceListener' of types 'EventEmitter' and 'Writable' are not identical. 
typings/globals/node/index.d.ts(621,22): error TS2320: Interface 'ClientRequest' cannot simultaneously extend types 'EventEmitter' and 'Writable'. 
    Named property 'removeListener' of types 'EventEmitter' and 'Writable' are not identical. 
typings/globals/node/index.d.ts(647,22): error TS2320: Interface 'IncomingMessage' cannot simultaneously extend types 'EventEmitter' and 'Readable'. 
    Named property 'addListener' of types 'EventEmitter' and 'Readable' are not identical. 
typings/globals/node/index.d.ts(647,22): error TS2320: Interface 'IncomingMessage' cannot simultaneously extend types 'EventEmitter' and 'Readable'. 
    Named property 'emit' of types 'EventEmitter' and 'Readable' are not identical. 
typings/globals/node/index.d.ts(647,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(647,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(647,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(647,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(647,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(698,18): error TS2300: Duplicate identifier 'Agent'. 
typings/globals/node/index.d.ts(743,18): error TS2300: Duplicate identifier 'Worker'. 
typings/globals/node/index.d.ts(1004,22): error TS2300: Duplicate identifier 'CompleterResult'. 
typings/globals/node/index.d.ts(1044,18): error TS2300: Duplicate identifier 'Script'. 
typings/globals/node/index.d.ts(1886,18): error TS2300: Duplicate identifier 'TLSSocket'. 
typings/globals/node/index.d.ts(2343,5): error TS2300: Duplicate identifier 'export='. 
typings/globals/node/index.d.ts(2365,18): error TS2300: Duplicate identifier 'Domain'. 
typings/globals/node/index.d.ts(2625,5): error TS2300: Duplicate identifier 'export='. 

उत्तर

11

ऐसा लगता है कि आपके पास दो स्थानों में नोड टाइपिंग है।

node_modules/@types/node/index.d.ts

typings/वैश्विक/नोड/index.d.ts

+0

धन्यवाद, स्पॉट ऑन। @types फ़ोल्डर को हटाने से समस्या ठीक हुई। हालांकि कोई विचार नहीं कि मैं डुप्लिकेट के साथ क्यों समाप्त हुआ हूं। – prime

+0

@types फ़ोल्डर –

+0

में किसी अन्य पैकेज की निर्भरता हो सकती है हां फिर से सही हैं। किसी भी विचार को संघर्ष को रोकने के लिए कैसे? यह दिखाई देगा @types एक आम निर्भरता है। – prime

2

जैसा कि पहले उल्लेख किया है, आप मिश्रित करने के लिए @types (typescript2 का उपयोग करके लगते हैं) टाइपिंग के साथ। जब मैं टाइपस्क्रिप्ट 2.x में अपग्रेड किया तो बस मुझे पसंद है। मुझे बिल्कुल वही त्रुटियां मिलीं। । https://stackoverflow.com/a/40627265/333150

यह @types स्थान से प्रकारों में से किसी को शामिल नहीं मूल रूप से होगा, और केवल उपयोग: मैं बस tsconfig में compilerOptions में प्रकार घोषणा "types": [] जोड़कर हल मैं और अधिक विस्तार यहाँ में इस का वर्णन किया है अपने typings घोषणाओं।

0

typings.json फ़ाइल निकालने में ठीक कर देंगे।

कोणीय शुरुआत वाली परियोजना के पिछले संस्करण में इस फ़ाइल शामिल थे। हालांकि, जब कोणीय का नवीनतम संस्करण में नवीनीकृत करने की कोशिश कर रहा, मैंने पाया कि यह फ़ाइल अब क्विकस्टार्ट का हिस्सा नहीं है। यह remov था this commit में एड। क्विकस्टार्ट के अपडेट को देखकर सहायक होता है यदि आप मूल रूप से उस कोड के अपने प्रोजेक्ट को बंद करते हैं।

संबंधित मुद्दे