Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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 90,825 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. :-)