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

128
Views
Failed to lookup view "index" in views directory "views"

I'm currently getting this error when trying to render my view from my routes folder

Error: Failed to lookup view "index" in views directory Website\gaming-galaxy\views"

Here's my project tree inside of the gaming-galaxy project folder

gaming-galaxy
  public_html
  - css
  - fonts
  - img 
  routes
  - index.mjs
  src
  - app.mjs
  views
  - layouts
    - layouts.ejs
  - index.ejs
  - login.ejs
  - register.ejs
  .gitignore
  package.json

Here's my views configuration in "app.mjs"

expressapp.set('views', path.join(__dirname , '../views'));

Finally, my route i'm trying to use index.mjs

import express from 'express'

import path from 'path'; 

const moduleURL = new URL(import.meta.url);

const __dirname = path.dirname(moduleURL.pathname);

var indexRouter = express.Router();

indexRouter.get('/', (req, res) => {
    console.log("Attempting to render index.ejs")
    res.render('index');
    console.log("Passed test!");
})

export default indexRouter; 

Any ideas on what could be causing this? I've been scratching my head at this one for hours now.

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!