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 (2015) Using Templates with Express Scaffolding Your Project’s Templates

Harpreet Singh
Harpreet Singh
3,830 Points

Indent error - layout.jade

This is the error I'm getting:

Error: /Users/harpreetsingh/Desktop/Javascript Training/Treehouse/Express Basics/Scaffolding Your Project’s Templates/S4V5/src/templates/index.jade:2 1| extends ./layout.jade

2| header 3| .header-content 4| .header-content-inner 5| h1 Fitness meets data science.

unexpected token "indent" at Parser.parseExpr (/Users/harpreetsingh/Desktop/Javascript Training/Treehouse/Express Basics/Scaffolding Your Project’s Templates/S4V5/node_modules/jade/lib/parser.js:254:15) at Parser.parse (/Users/harpreetsingh/Desktop/Javascript Training/Treehouse/Express Basics/Scaffolding Your Project’s Templates/S4V5/node_modules/jade/lib/parser.js:122:25) at parse (/Users/harpreetsingh/Desktop/Javascript Training/Treehouse/Express Basics/Scaffolding Your Project’s Templates/S4V5/node_modules/jade/lib/index.js:104:21) at Object.exports.compile (/Users/harpreetsingh/Desktop/Javascript Training/Treehouse/Express Basics/Scaffolding Your Project’s Templates/S4V5/node_modules/jade/lib/index.js:205:16) at handleTemplateCache (/Users/harpreetsingh/Desktop/Javascript Training/Treehouse/Express Basics/Scaffolding Your Project’s Templates/S4V5/node_modules/jade/lib/index.js:174:25) at Object.exports.renderFile (/Users/harpreetsingh/Desktop/Javascript Training/Treehouse/Express Basics/Scaffolding Your Project’s Templates/S4V5/node_modules/jade/lib/index.js:380:10) at Object.exports.renderFile (/Users/harpreetsingh/Desktop/Javascript Training/Treehouse/Express Basics/Scaffolding Your Project’s Templates/S4V5/node_modules/jade/lib/index.js:370:21) at View.exports.__express as engine at View.render (/Users/harpreetsingh/Desktop/Javascript Training/Treehouse/Express Basics/Scaffolding Your Project’s Templates/S4V5/node_modules/express/lib/view.js:128:8)

2 Answers

Jesus Mendoza
Jesus Mendoza
23,288 Points

Can you show the content of your file?

Tre Dudman
Tre Dudman
10,575 Points

A common solution may be to check that your indents (your tabs or spaces) are consistent on your page

Another classic problem is with partials. Generally you have your include statement indented in your main file, so for Jade/Pug to not break you need your code in you partial starting from an indent on 0

Jade/Pug wants you to choose tabs OR spaces and will fail when it interprets both on a page