title: Nestjs Error: Cannot find module './app.controller'
body: <p>I cant seem to locate where the error is coming from as the app compiled with <code>Found 0 errors. Watching for file changes.</code> I have seen similar resolve on StackOverflow but none seem to address the issue</p>
  
  <p>Here is the stack trace</p>
  
  <pre><code>internal/modules/cjs/loader.js:797
      throw err;
      ^
  
  Error: Cannot find module './app.controller'
  Require stack:
  - C:\Users\DELL\Documents\DokunFiles\Nestjs\app\api\dist\src\app.module.js
  - C:\Users\DELL\Documents\DokunFiles\Nestjs\app\api\dist\src\main.js
  </code></pre>
  
  <p>With the appModule below, the app controller is properly imported into the app module</p>
  
  <p>app.module.ts</p>
  
  <pre><code>import { Module } from '@nestjs/common';
  import { MongooseModule } from '@nestjs/mongoose';
  
  import { AppController } from './app.controller';
  import { AppService } from './app.service';
  import { UserModule } from './user/user.module';
  
  
  @Module({
    imports: [MongooseModule.forRoot(process.env.MONGO_URI,
      {
        useNewUrlParser: true,
        useUnifiedTopology: true
      })
      , UserModule,
    ],
    controllers: [AppController],
    providers: [AppService],
  })
  export class AppModule { }
  
  </code></pre>
  
  <p>app.controller.ts</p>
  
  <pre><code>import { Controller, Get } from '@nestjs/common';
  import { AppService } from './app.service';
  
  @Controller()
  export class AppController {
    constructor(private readonly appService: AppService) {}
  
    @Get()
    getHello(): string {
      return this.appService.getHello();
    }
  }
  
  </code></pre>