Express.js, Node.js Jade vim


Help, before I throw my beautiful, expensive MacBook Pro to the ground in a fit of annoyance.

I'm trying to get something working in Expressjs, and it's really getting on my nerves. I'm following the tutorial on: expressjs.com/screencasts.html

Screencast 2:

And I'm getting this error message:

Express 500 Error: /home/duncan/helloExpress/views/users.jade:4 2| p#users 3| - each user in users > 4| li user.name 5| expected "indent", but got "newline" * 2| p#users * 3| - each user in users * > 4| li user.name * 5| * * expected "indent", but got "newline" * at Object.expect (/usr/local/lib/node/.npm/jade/0.10.6/package/lib/parser.js:131:13) * at Object.parseBlock (/usr/local/lib/node/.npm/jade/0.10.6/package/lib/parser.js:330:10) * at Object.parseEach (/usr/local/lib/node/.npm/jade/0.10.6/package/lib/parser.js:289:64) * at Object.parseExpr (/usr/local/lib/node/.npm/jade/0.10.6/package/lib/parser.js:175:21) * at Object.parseBlock (/usr/local/lib/node/.npm/jade/0.10.6/package/lib/parser.js:335:25) * at Object.parseTag (/usr/local/lib/node/.npm/jade/0.10.6/package/lib/parser.js:425:26) * at Object.parseExpr (/usr/local/lib/node/.npm/jade/0.10.6/package/lib/parser.js:163:21) * at Object.parse (/usr/local/lib/node/.npm/jade/0.10.6/package/lib/parser.js:114:25) * at parse (/usr/local/lib/node/.npm/jade/0.10.6/package/lib/jade.js:179:62) * at Object.compile (/usr/local/lib/node/.npm/jade/0.10.6/package/lib/jade.js:224:7)

Please help, I get that it's getting a newline when it's expecting an indent by why? And how do I fix the blooming thing!!

My users.jade is as follows:

h1 Users p#users - each user in users li user.name <h2>------------------</h2> <hr /><h2>SO NOW THE ISSUE IS...</h2> <hr />

OK so now, it's been pointed out that I should be using a ul instead of a p (paragraph) element - pretty obvious once you notice it, though the error message, could be better.

However, I'm now getting the following errors: Though I'm now getting the following error:

Express 500 SyntaxError: Unexpected identifier * at Object.Function (unknown source) * at Object.compile (/usr/local/lib/node/.npm/jade/0.10.6/package/lib/jade.js:230:10) * at ServerResponse._render (/usr/local/lib/node/.npm/express/2.3.2/package/lib/view.js:368:22) * at ServerResponse.render (/usr/local/lib/node/.npm/express/2.3.2/package/lib/view.js:234:17) * at Object. (/home/duncan/helloExpress/app.js:46:7) * at nextMiddleware (/usr/local/lib/node/.npm/express/2.3.2/package/lib/router/index.js:139:34) * at param (/usr/local/lib/node/.npm/express/2.3.2/package/lib/router/index.js:147:16) * at pass (/usr/local/lib/node/.npm/express/2.3.2/package/lib/router/index.js:155:10) * at Object.router [as handle] (/usr/local/lib/node/.npm/express/2.3.2/package/lib/router/index.js:161:6) * at next (/usr/local/lib/node/.npm/connect/1.4.0/package/lib/http.js:204:15)

My app.js code is as follows:

var users = [ { name: 'Duncan', email: 'duncan@email.com'}, { name: 'Bob', email: 'bob@email.com'} ];


app.get('/users', function(req, res){ res.render('users', { users: users }); });

I don't know if I'm just being blind today, but I would really like to get this example working.

NB. app.js 46:7 is the 'res.render' char 7 is the . between res and render.


I changed the p to a ul (p tags shouldn't have children). And I defined the users array in the jade ( which works well for testing ).

note the indentation after the - each and the li=.

- users = [ { name:'Duncan' }, { name: 'Henry'}, { name: 'Raynos' } ] h1 Users ul#users - each user in users li= user.name


ul - each item in sidebars li a(href=item.href,target='_self') !{item.name}


sounds like it might have problems with significant whitespace.


h1 Users p#users - each user in users li user.name

It might dislike your indenting. Also generally updating to later versions of jade / node / express can help.


h1 Users p#users - each user in users li user.name

Try that


I too faced the same issue but my code was like this


h2 All Users ul each user in users li #{user.name}


h2 All Users ul - each user in users li #{user.name}

It is the matter of adding - before each statement


  • Error: Cannot find module 'paypal-ipn'
  • Build React components with Gulp, Browserify and Babel
  • Understanding CORS handling for external service in Angular2
  • Moment.js plugins in Ionic2/Cordova typescript project
  • npm install killed without a good error
  • Object doesn't support property or method 'json' servicestack-client HTTP post
  • MFP CLI 7.1 adapter wont deploy with mfp push command
  • Substitute a package in NPM/Node
  • cannot start angular-phonecat, postinstall script failing [closed]
  • dynamic type tests not working as expected
  • named parameter to npm run script
  • How to use variables in npm scripts on windows
  • Jenkins Build Error: Build step 'Invoke top-level Maven targets' marked build as failure
  • Bcrypt installation fails in Docker
  • npm thinks node is out of date, but it isn't
  • Excel VBA Intersect
  • How to get the index of element in the List in c#
  • Grunt watch Running “watch” task Waiting
  • Cordova Apache wrong module path
  • how to set to NULL all the filestream varbinary(max) fields?
  • Simple linked list-C
  • NUnit 3.0 TestCase const custom object arguments
  • How to generate and display a QR Code in ionic 2
  • CakePHP ACL tutorial initDB function warnings
  • Groovy: Unexpected token “:”
  • Java Scanner input dilemma. Automatically inputs without allowing user to type
  • Master page gives error
  • Read text file and split every line in MSBuild
  • How to make a tree having multiple type of nodes and each node can have multiple child nodes in java
  • Bug in WPF DataGrid
  • TFS: Get latest causes slow project reloading
  • Javascript Callbacks with Object constructor
  • How to make Safari send if-modified-since header?
  • need help with bizarre java.net.HttpURLConnection behavior
  • Qt: Run a script BEFORE make
  • Can't mass-assign protected attributes when import data from csv file
  • sending mail using smtp is too slow
  • How can i traverse a binary tree from right to left in java?