microsoft / TypeScript-Node-Starter

A reference example for TypeScript and Node with a detailed README describing how to use the two together.
MIT License
11.31k stars 2.77k forks source link

build fails #42

Closed mjknight50 closed 6 years ago

mjknight50 commented 7 years ago

I have followed the basic instructions on the readme, but I can't get a basic build.

npm ERR! Failed at the express-typescript-starter@0.1.0 build script 'npm run build-sass && npm run build-ts && npm run tslint && npm run copy-static-assets'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the express-typescript-starter package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! npm run build-sass && npm run build-ts && npm run tslint && npm run copy-static-assets

running: tsc node_modules/@types/jest/index.d.ts(7,13): error TS2300: Duplicate identifier 'beforeAll'. node_modules/@types/jest/index.d.ts(8,13): error TS2300: Duplicate identifier 'beforeEach'. node_modules/@types/jest/index.d.ts(9,13): error TS2300: Duplicate identifier 'afterAll'. node_modules/@types/jest/index.d.ts(10,13): error TS2300: Duplicate identifier 'afterEach'. node_modules/@types/jest/index.d.ts(11,13): error TS2300: Duplicate identifier 'describe'. node_modules/@types/jest/index.d.ts(12,13): error TS2300: Duplicate identifier 'fdescribe'. node_modules/@types/jest/index.d.ts(13,13): error TS2300: Duplicate identifier 'xdescribe'. node_modules/@types/jest/index.d.ts(14,13): error TS2300: Duplicate identifier 'it'. node_modules/@types/jest/index.d.ts(15,13): error TS2300: Duplicate identifier 'fit'. node_modules/@types/jest/index.d.ts(16,13): error TS2300: Duplicate identifier 'xit'. node_modules/@types/jest/index.d.ts(20,15): error TS2451: Cannot redeclare block-scoped variable 'expect'. node_modules/@types/jest/index.d.ts(339,45): error TS2314: Generic type 'ObjectContaining' requires 1 type argument(s). node_modules/@types/jest/index.d.ts(368,15): error TS2428: All declarations of 'ObjectContaining' must have identical type parameters. node_modules/@types/jest/index.d.ts(431,15): error TS2300: Duplicate identifier 'CustomMatcherFactory'. node_modules/@types/jest/index.d.ts(441,15): error TS2300: Duplicate identifier 'CustomEqualityTester'. ../../../node_modules/@types/jasmine/index.d.ts(15,18): error TS2300: Duplicate identifier 'describe'. ../../../node_modules/@types/jasmine/index.d.ts(16,18): error TS2300: Duplicate identifier 'fdescribe'. ../../../node_modules/@types/jasmine/index.d.ts(17,18): error TS2300: Duplicate identifier 'xdescribe'. ../../../node_modules/@types/jasmine/index.d.ts(26,18): error TS2300: Duplicate identifier 'it'. ../../../node_modules/@types/jasmine/index.d.ts(35,18): error TS2300: Duplicate identifier 'fit'. ../../../node_modules/@types/jasmine/index.d.ts(36,18): error TS2300: Duplicate identifier 'xit'. ../../../node_modules/@types/jasmine/index.d.ts(51,18): error TS2300: Duplicate identifier 'beforeEach'. ../../../node_modules/@types/jasmine/index.d.ts(58,18): error TS2300: Duplicate identifier 'afterEach'. ../../../node_modules/@types/jasmine/index.d.ts(66,18): error TS2300: Duplicate identifier 'beforeAll'. ../../../node_modules/@types/jasmine/index.d.ts(74,18): error TS2300: Duplicate identifier 'afterAll'. ../../../node_modules/@types/jasmine/index.d.ts(80,18): error TS2451: Cannot redeclare block-scoped variable 'expect'. ../../../node_modules/@types/jasmine/index.d.ts(86,18): error TS2451: Cannot redeclare block-scoped variable 'expect'. ../../../node_modules/@types/jasmine/index.d.ts(92,18): error TS2451: Cannot redeclare block-scoped variable 'expect'. ../../../node_modules/@types/jasmine/index.d.ts(171,9): error TS2375: Duplicate number index signature. ../../../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/jasmine/index.d.ts(219,10): error TS2300: Duplicate identifier 'CustomMatcherFactory'. ../../../node_modules/@types/jasmine/index.d.ts(222,9): error TS2374: Duplicate string index signature. ../../../node_modules/@types/jasmine/index.d.ts(227,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'message' must be of type 'string | (() => string)', but here has type 'string'. ../../../node_modules/@types/jasmine/index.d.ts(227,9): error TS2687: All declarations of 'message' must have identical modifiers.

hookdump commented 7 years ago

Getting the same error.

➜  express git:(master) ✗ node -v
v7.6.0
➜  express git:(master) ✗ npm -v
5.3.0
➜  express git:(master) ✗ tsc -v
Version 2.4.2
crisz commented 7 years ago

I had installed the modules with yarn and it gave me the same error, so I deleted the node_modules folder and I re-installed everything with npm, this time it worked. But we have the same npm version so I can't understand why

mjknight50 commented 6 years ago

No activity...

Zaniyar commented 4 years ago

Now using node v12.13.0 (npm v6.12.0)

(base) clt-mob-t-5068:dashboardBackend fox$ npm run build

> express-typescript-starter@0.1.0 build /Users/fox/project/industry4dashboard/dashboardBackend
> npm run build-sass && npm run build-ts && npm run lint && npm run copy-static-assets

> express-typescript-starter@0.1.0 build-sass /Users/fox/project/industry4dashboard/dashboardBackend
> node-sass src/public/css/main.scss dist/public/css/main.css

Rendering Complete, saving .css file...
Wrote CSS to /Users/fox/project/industry4dashboard/dashboardBackend/dist/public/css/main.css

> express-typescript-starter@0.1.0 build-ts /Users/fox/project/industry4dashboard/dashboardBackend
> tsc

node_modules/@types/jest/index.d.ts:33:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: describe, fdescribe, xdescribe, it, fit, xit, beforeEach, afterEach, beforeAll, afterAll, expect, CustomEqualityTester, CustomMatcherFactory, DEFAULT_TIMEOUT_INTERVAL

33 declare var beforeAll: jest.Lifecycle;
   ~~~~~~~

  ../node_modules/@types/jasmine/ts3.1/index.d.ts:22:1
    22 type ImplementationCallback = jasmine.ImplementationCallback;
       ~~~~
    Conflicts are in this file.

node_modules/@types/jest/index.d.ts:33:13 - error TS2300: Duplicate identifier 'beforeAll'.

33 declare var beforeAll: jest.Lifecycle;
               ~~~~~~~~~

  ../node_modules/@types/jasminewd2/index.d.ts:15:18
    15 declare function beforeAll(action: (done: DoneFn) => Promise<void>, timeout?: number): void;
                        ~~~~~~~~~
    'beforeAll' was also declared here.

node_modules/@types/jest/index.d.ts:34:13 - error TS2300: Duplicate identifier 'beforeEach'.

34 declare var beforeEach: jest.Lifecycle;
               ~~~~~~~~~~

  ../node_modules/@types/jasminewd2/index.d.ts:13:18
    13 declare function beforeEach(action: (done: DoneFn) => Promise<void>, timeout?: number): void;
                        ~~~~~~~~~~
    'beforeEach' was also declared here.

node_modules/@types/jest/index.d.ts:35:13 - error TS2300: Duplicate identifier 'afterAll'.

35 declare var afterAll: jest.Lifecycle;
               ~~~~~~~~

  ../node_modules/@types/jasminewd2/index.d.ts:16:18
    16 declare function afterAll(action: (done: DoneFn) => Promise<void>, timeout?: number): void;
                        ~~~~~~~~
    'afterAll' was also declared here.

node_modules/@types/jest/index.d.ts:36:13 - error TS2300: Duplicate identifier 'afterEach'.

36 declare var afterEach: jest.Lifecycle;
               ~~~~~~~~~

  ../node_modules/@types/jasminewd2/index.d.ts:14:18
    14 declare function afterEach(action: (done: DoneFn) => Promise<void>, timeout?: number): void;
                        ~~~~~~~~~
    'afterEach' was also declared here.

node_modules/@types/jest/index.d.ts:40:13 - error TS2300: Duplicate identifier 'it'.

40 declare var it: jest.It;
               ~~

  ../node_modules/@types/jasminewd2/index.d.ts:10:18
    10 declare function it(expectation: string, assertion?: (done: DoneFn) => Promise<void>, timeout?: number): void;
                        ~~
    'it' was also declared here.

node_modules/@types/jest/index.d.ts:41:13 - error TS2300: Duplicate identifier 'fit'.

41 declare var fit: jest.It;
               ~~~

  ../node_modules/@types/jasminewd2/index.d.ts:11:18
    11 declare function fit(expectation: string, assertion?: (done: DoneFn) => Promise<void>, timeout?: number): void;
                        ~~~
    'fit' was also declared here.

node_modules/@types/jest/index.d.ts:42:13 - error TS2300: Duplicate identifier 'xit'.

42 declare var xit: jest.It;
               ~~~

  ../node_modules/@types/jasminewd2/index.d.ts:12:18
    12 declare function xit(expectation: string, assertion?: (done: DoneFn) => Promise<void>, timeout?: number): void;
                        ~~~
    'xit' was also declared here.

node_modules/@types/jest/index.d.ts:1353:46 - error TS2314: Generic type 'ArrayContaining<T>' requires 1 type argument(s).

1353     function arrayContaining(sample: any[]): ArrayContaining;
                                                  ~~~~~~~~~~~~~~~

node_modules/@types/jest/index.d.ts:1354:45 - error TS2314: Generic type 'ObjectContaining<T>' requires 1 type argument(s).

1354     function objectContaining(sample: any): ObjectContaining;
                                                 ~~~~~~~~~~~~~~~~

node_modules/@types/jest/index.d.ts:1380:15 - error TS2428: All declarations of 'ArrayContaining' must have identical type parameters.

1380     interface ArrayContaining {
                   ~~~~~~~~~~~~~~~

node_modules/@types/jest/index.d.ts:1386:15 - error TS2428: All declarations of 'ObjectContaining' must have identical type parameters.

1386     interface ObjectContaining {
                   ~~~~~~~~~~~~~~~~

node_modules/@types/jest/index.d.ts:1395:14 - error TS2314: Generic type 'SpyAnd<Fn>' requires 1 type argument(s).

1395         and: SpyAnd;
                  ~~~~~~

node_modules/@types/jest/index.d.ts:1396:16 - error TS2314: Generic type 'Calls<Fn>' requires 1 type argument(s).

1396         calls: Calls;
                    ~~~~~

node_modules/@types/jest/index.d.ts:1402:15 - error TS2428: All declarations of 'SpyAnd' must have identical type parameters.

1402     interface SpyAnd {
                   ~~~~~~

node_modules/@types/jest/index.d.ts:1435:15 - error TS2428: All declarations of 'Calls' must have identical type parameters.

1435     interface Calls {
                   ~~~~~

node_modules/@types/jest/index.d.ts:1461:16 - error TS2314: Generic type 'CallInfo<Fn>' requires 1 type argument(s).

1461         all(): CallInfo[];
                    ~~~~~~~~

node_modules/@types/jest/index.d.ts:1466:23 - error TS2314: Generic type 'CallInfo<Fn>' requires 1 type argument(s).

1466         mostRecent(): CallInfo;
                           ~~~~~~~~

node_modules/@types/jest/index.d.ts:1471:18 - error TS2314: Generic type 'CallInfo<Fn>' requires 1 type argument(s).

1471         first(): CallInfo;
                      ~~~~~~~~

node_modules/@types/jest/index.d.ts:1478:15 - error TS2428: All declarations of 'CallInfo' must have identical type parameters.

1478     interface CallInfo {
                   ~~~~~~~~

node_modules/@types/jest/index.d.ts:1514:9 - error TS2687: All declarations of 'message' must have identical modifiers.

1514         message: string | (() => string);
             ~~~~~~~

../node_modules/@types/jasmine/ts3.1/index.d.ts:22:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: describe, fdescribe, xdescribe, it, fit, xit, beforeEach, afterEach, beforeAll, afterAll, expect, CustomEqualityTester, CustomMatcherFactory, DEFAULT_TIMEOUT_INTERVAL

22 type ImplementationCallback = jasmine.ImplementationCallback;
   ~~~~

  node_modules/@types/jest/index.d.ts:33:1
    33 declare var beforeAll: jest.Lifecycle;
       ~~~~~~~
    Conflicts are in this file.

../node_modules/@types/jasmine/ts3.1/index.d.ts:307:9 - error TS2375: Duplicate number index signature.

307         [n: number]: T;
            ~~~~~~~~~~~~~~~

../node_modules/@types/jasmine/ts3.1/index.d.ts:310:15 - error TS2428: All declarations of 'ArrayContaining' must have identical type parameters.

310     interface ArrayContaining<T> extends AsymmetricMatcher<any> {
                  ~~~~~~~~~~~~~~~

../node_modules/@types/jasmine/ts3.1/index.d.ts:314:15 - error TS2428: All declarations of 'ObjectContaining' must have identical type parameters.

314     interface ObjectContaining<T> extends AsymmetricMatcher<T> {
                  ~~~~~~~~~~~~~~~~

../node_modules/@types/jasmine/ts3.1/index.d.ts:318:9 - error TS2386: Overload signatures must all be optional or required.

318         jasmineToString?(): string;
            ~~~~~~~~~~~~~~~

../node_modules/@types/jasmine/ts3.1/index.d.ts:365:9 - error TS2374: Duplicate string index signature.

365         [name: string]: CustomMatcherFactory;
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../node_modules/@types/jasmine/ts3.1/index.d.ts:374:9 - error TS2687: All declarations of 'message' must have identical modifiers.

374         message?: string;
            ~~~~~~~

../node_modules/@types/jasmine/ts3.1/index.d.ts:374:9 - error TS2717: Subsequent property declarations must have the same type.  Property 'message' must be of type 'string | (() => string)', but here has type 'string'.

374         message?: string;
            ~~~~~~~

  node_modules/@types/jest/index.d.ts:1514:9
    1514         message: string | (() => string);
                 ~~~~~~~
    'message' was also declared here.

../node_modules/@types/jasmine/ts3.1/index.d.ts:918:15 - error TS2428: All declarations of 'SpyAnd' must have identical type parameters.

918     interface SpyAnd<Fn extends Func> {
                  ~~~~~~

../node_modules/@types/jasmine/ts3.1/index.d.ts:939:15 - error TS2428: All declarations of 'Calls' must have identical type parameters.

939     interface Calls<Fn extends Func> {
                  ~~~~~

../node_modules/@types/jasmine/ts3.1/index.d.ts:958:15 - error TS2428: All declarations of 'CallInfo' must have identical type parameters.

958     interface CallInfo<Fn extends Func> {
                  ~~~~~~~~

../node_modules/@types/jasmine/ts3.1/index.d.ts:962:9 - error TS2717: Subsequent property declarations must have the same type.  Property 'args' must be of type 'any[]', but here has type 'Parameters<Fn>'.

962         args: Parameters<Fn>;
            ~~~~

  node_modules/@types/jest/index.d.ts:1486:9
    1486         args: any[];
                 ~~~~
    'args' was also declared here.

../node_modules/@types/jasmine/ts3.1/index.d.ts:964:9 - error TS2717: Subsequent property declarations must have the same type.  Property 'returnValue' must be of type 'any', but here has type 'ReturnType<Fn>'.

964         returnValue: ReturnType<Fn>;
            ~~~~~~~~~~~

  node_modules/@types/jest/index.d.ts:1490:9
    1490         returnValue: any;
                 ~~~~~~~~~~~
    'returnValue' was also declared here.

../node_modules/@types/jasminewd2/index.d.ts:10:18 - error TS2300: Duplicate identifier 'it'.

10 declare function it(expectation: string, assertion?: (done: DoneFn) => Promise<void>, timeout?: number): void;
                    ~~

  node_modules/@types/jest/index.d.ts:40:13
    40 declare var it: jest.It;
                   ~~
    'it' was also declared here.

../node_modules/@types/jasminewd2/index.d.ts:11:18 - error TS2300: Duplicate identifier 'fit'.

11 declare function fit(expectation: string, assertion?: (done: DoneFn) => Promise<void>, timeout?: number): void;
                    ~~~

  node_modules/@types/jest/index.d.ts:41:13
    41 declare var fit: jest.It;
                   ~~~
    'fit' was also declared here.

../node_modules/@types/jasminewd2/index.d.ts:12:18 - error TS2300: Duplicate identifier 'xit'.

12 declare function xit(expectation: string, assertion?: (done: DoneFn) => Promise<void>, timeout?: number): void;
                    ~~~

  node_modules/@types/jest/index.d.ts:42:13
    42 declare var xit: jest.It;
                   ~~~
    'xit' was also declared here.

../node_modules/@types/jasminewd2/index.d.ts:13:18 - error TS2300: Duplicate identifier 'beforeEach'.

13 declare function beforeEach(action: (done: DoneFn) => Promise<void>, timeout?: number): void;
                    ~~~~~~~~~~

  node_modules/@types/jest/index.d.ts:34:13
    34 declare var beforeEach: jest.Lifecycle;
                   ~~~~~~~~~~
    'beforeEach' was also declared here.

../node_modules/@types/jasminewd2/index.d.ts:14:18 - error TS2300: Duplicate identifier 'afterEach'.

14 declare function afterEach(action: (done: DoneFn) => Promise<void>, timeout?: number): void;
                    ~~~~~~~~~

  node_modules/@types/jest/index.d.ts:36:13
    36 declare var afterEach: jest.Lifecycle;
                   ~~~~~~~~~
    'afterEach' was also declared here.

../node_modules/@types/jasminewd2/index.d.ts:15:18 - error TS2300: Duplicate identifier 'beforeAll'.

15 declare function beforeAll(action: (done: DoneFn) => Promise<void>, timeout?: number): void;
                    ~~~~~~~~~

  node_modules/@types/jest/index.d.ts:33:13
    33 declare var beforeAll: jest.Lifecycle;
                   ~~~~~~~~~
    'beforeAll' was also declared here.

../node_modules/@types/jasminewd2/index.d.ts:16:18 - error TS2300: Duplicate identifier 'afterAll'.

16 declare function afterAll(action: (done: DoneFn) => Promise<void>, timeout?: number): void;
                    ~~~~~~~~

  node_modules/@types/jest/index.d.ts:35:13
    35 declare var afterAll: jest.Lifecycle;
                   ~~~~~~~~
    'afterAll' was also declared here.

deleted node_modules folder and reinstalled everything with npm. still not working.

Zaniyar commented 4 years ago

Ok found out that typescript was also trying to look into parent directories to find types; you can prevent it by doing this: add this line to the tsconfig.json in the compilerOptions:

"typeRoots": ["./node_modules/@types"],

now it will only look into this folder for types and won't find duplicated declarations.