Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDaniel Hernandez
13,437 PointsI keep getting "Error: Failed to lookup view "card" in views directory"
I continually keep getting the same error and don't know what I am doing wrong. It says 'error:failed to lookup view "card" in views directory'.Here is my javascript code, any help would be very much appreciated, thank you.
const express = require('express');
const app = express();
app.set('view engine', 'pug')
app.get('/', (req, res) =>{
res.render("index");
});
app.get('/cards', (req, res) =>{
res.locals.prompt = "Who is buried in Grant's tomb?";
res.render('card');
});
app.listen(3000, ()=> {
console.log('The application is running on port 3000')
});
1 Answer
Daniel Hernandez
13,437 PointsNever-mind I solved it. I forgot to duplicate the index.pug file and make a card.pug file. Such a silly mistake to make! Never-mind everybody, sorry.