Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

450
Views
NestJS Monorepo Microservice EJS Error Failed to lookup view "index" in views directory "..\fin\dist\.."

I'm building a NestJS microservice app in monorepo with fin as the default microservice.

I'm using EJS templating.

But once I run the project, I get the error, "ERROR [ExceptionsHandler] Failed to lookup view "index" in views directory "D:\Studio\Work...\fin\dist\apps\views"".

I've tried different configurations for directory path in app.setBaseViewsDir() but all have not worked;

Could you please help me spot the problem?

Thanks in advance!

The project directory folder looks something like below;


+ fin
  + apps 
    + fin
      + src
        + views 

          -index.ejs

        -app.controller.ts

        -main.ts
  + image      

  -package.json

  -tsconfig.json

The fin main.ts file looks something like;

main.ts:


import { NestFactory } from '@nestjs/core';
import { NestExpressApplication } from '@nestjs/platform-express';
import { resolve } from 'path';
import { AppModule } from './app.module';

async function bootstrap() {
  const app = await NestFactory.create<NestExpressApplication>(AppModule);
  app.useStaticAssets(resolve('../src/assets'));
  app.setBaseViewsDir(resolve('../src/views'));
  app.setViewEngine('ejs');
  await app.listen(6006);
  console.log(`Fin PEN started successfully on Port 6006`);
}
bootstrap();

The tsconfig.json looks like below.

tsconfig.json:


{
  "compilerOptions": {
    ...
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./"
    ...
  }
}

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!