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 trial

JavaScript Express Basics Deeper into Routing with Express POST Requests

Server pug extending error in express basics course

Hi I am getting this error when trying to launch my server, then when the server is up it shows this error: flashcards\views\index.pug:4:1

Only named blocks and mixins can appear at the top level of an extending template at makeError (C:\Users\Alessio Toniolo\Desktop\FTC\flashcards\node_modules\pug-error\index.js:34:13) at error (C:\Users\Alessio Toniolo\Desktop\FTC\flashcards\node_modules\pug-linker\index.js:7:30) at addNode (C:\Users\Alessio Toniolo\Desktop\FTC\flashcards\node_modules\pug-linker\index.js:37:9) at Array.forEach (<anonymous>) at link (C:\Users\Alessio Toniolo\Desktop\FTC\flashcards\node_modules\pug-linker\index.js:29:15) at compileBody (C:\Users\Alessio Toniolo\Desktop\FTC\flashcards\node_modules\pug\lib\index.js:192:9) at Object.exports.compile (C:\Users\Alessio Toniolo\Desktop\FTC\flashcards\node_modules\pug\lib\index.js:267:16) at handleTemplateCache (C:\Users\Alessio Toniolo\Desktop\FTC\flashcards\node_modules\pug\lib\index.js:240:25) at Object.exports.renderFile (C:\Users\Alessio Toniolo\Desktop\FTC\flashcards\node_modules\pug\lib\index.js:452:10) at Object.exports.renderFile (C:\Users\Alessio Toniolo\Desktop\FTC\flashcards\node_modules\pug\lib\index.js:442:21)

I think it is related to the pug somehow but I checked my code with the videos and it seemed good. Help!

1 Answer

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

We'd probably need to see your PUG template code and app.js file to see what's wrong.

Also try npm install to make sure no dependencies are missing. :-)