Search code examples
nestjsturborepo

NestJS doesn't start within apps


I recently started using turborepo. I added a new app into /apps directory, called api by doing the following

$ cd apps
$ nest new api

Now if I try and run nest api

$ cd api
$ yarn start:dev

It fails with following error,

../../node_modules/@types/react-dom/node_modules/@types/react/index.d.ts:3100:14 - error         type LibraryManagedAttributes<C, P>dAttributes'.
                  ~~~~~~~~~~~~~~~~~~~~~~~~
3100
  ../../node_modules/@types/react/index.d.ts:3100:14
    3100         type LibraryManagedAttributes<C, P> = C extends React.MemoExoticComponent<infer T> | React.LazyExoticComponent<infer T>
                      ~~~~~~~~~~~~~~~~~~~~~~~~
    'LibraryManagedAttributes' was also declared here.

../../node_modules/@types/react/index.d.ts:3100:14 - error TS2300: Duplicate identifier 'LibraryManagedAttributes'.

3100         type LibraryManagedAttributes<C, P> = C extends React.MemoExoticComponent<infer T> | React.LazyExoticComponent<infer T>
                  ~~~~~~~~~~~~~~~~~~~~~~~~

  ../../node_modules/@types/react-dom/node_modules/@types/react/index.d.ts:3100:14
    3100         type LibraryManagedAttributes<C, P> = C extends React.MemoExoticComponent<infer T> | React.LazyExoticComponent<infer T>
                      ~~~~~~~~~~~~~~~~~~~~~~~~
    'LibraryManagedAttributes' was also declared here.

[4:35:02 PM] Found 2 errors. Watching for file changes.


Help!


Solution

  • I got it to work after changing the tsconfig.json in apps/api

    {
      "extends": "tsconfig/base.json",
      "include": [
        "./**/*.ts"
      ],
      "exclude": [
        "node_modules"
      ],
      "compilerOptions": {
        "module": "commonjs",
        "declaration": true,
        "removeComments": true,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "allowSyntheticDefaultImports": true,
        "target": "es2017",
        "sourceMap": true,
        "outDir": "./dist",
        "baseUrl": "./",
        "incremental": true
      }
    }