Deploying pug files with NodeJS

Hi all , I built a web app on my local machine with Windows server and wanted to deploy it here.
I had some issues rendering the client server side pug files. I keep getting this error:
Failed to lookup view “HomePage” in views directory “/opt/render/project/src/views”
I made sure case sensitivity is not the routing problem here.
eventually after hours of debugging I came to realize there might be a problem rendering this specific file type.
I used both print logs lines on my machine and on the delopyed code
console.log(“Files in views directory:”, fs.readdirSync(path.join(__dirname, ‘views’))); //Debug

This will show me all the files exist in the folder views
at first the output on Render was empty, then i created an html file and repushed the code
final output is :
Render output:
Files in views directory: [ ‘test.html’ ]
Local Output:
Files in views directory: [

Did anyone manage to render pug files?
Here’s some of the code that is relevant to the error
// view engine setup

app.engine(‘html’,require(‘pug’).renderFile); // Debug
app.set(‘views’, path.join(__dirname,‘views’));
app.set(‘view engine’, ‘pug’);

app.get(‘/’,(req, res)=>{
console.log(“Current user is”+GetUser(req,res,“name”)) // Debug
res.render(‘HomePage’,{user: "Welcome back "+GetUser(req,res,“name”)}); // Fail on this line

Thanks alot!

Hi there,

I see you’ve also opened a support ticket on the same topic that’s being handled already. I’ll close this one out so we don’t duplicate efforts and threads.



This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.