Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

starting with the MEAN stack, just grunted

So, I'm getting MEAN. Everything is installed. I have some issues, though, and I'm hoping for a bit of guidance on how to read these error logs. I'm coming from Rails, for reference.

First things first, following along with http://mean.io/, npm install had some issues, but updating and clearing cache took care of it. Now I'm grunting. First thing I get is:

Express app started on port 3000

events.js:72
    throw er; // Unhandled 'error' event
          ^
Error: failed to connect to [localhost:27017]
at null.<anonymous>(D:\Dropbox\Apps\mean_projects\first\node_modules\mongoose\node_modules\mongodb\lib\mongodb\connection\server.js:540:74)
at EventEmitter.emit (events.js:106:17)
at null.<anonymous> (D:\Dropbox\Apps\mean_projects\first\node_modules\mongoose\node_modules\mongodb\lib\mongodb\connection\connection_pool.js:140:15)
at EventEmitter.emit (events.js:98:17)
at Socket.<anonymous> (D:\Dropbox\Apps\mean_projects\first\node_modules\mongoose\node_modules\mongodb\lib\mongodb\connection\connection.js:478:10)
at Socket.EventEmitter.emit (events.js:95:17)
at net.js:441:14
at process._tickCallback (node.js:415:13)
22 Dec 21:03:14 - [nodemon] app crashed - waiting for file changes before starting...

So, I took a guess and thought maybe I had to manually start mongo? mongod then in a new console, grunt. Express app started on port 3000!! Woot. Upon visiting http://localhost:3000/, I get this monstrosity:

Error: D:\Dropbox\Apps\mean_projects\first\app\views\layouts\default.jade:1 > 1| !!! 5 2| html(lang='en', xmlns='http://www.w3.org/1999/xhtml', xmlns:fb='https://www.facebook.com/2008/fbml', itemscope='itemscope', itemtype='http://schema.org/Product') 3| include ../includes/head 4| body `!!!` is deprecated, you must now use `doctype` at Object.Lexer.doctype (D:\Dropbox\Apps\mean_projects\first\node_modules\jade\lib\lexer.js:246:13) at Object.Lexer.next (D:\Dropbox\Apps\mean_projects\first\node_modules\jade\lib\lexer.js:812:15) at Object.Lexer.lookahead (D:\Dropbox\Apps\mean_projects\first\node_modules\jade\lib\lexer.js:111:46) at Parser.lookahead (D:\Dropbox\Apps\mean_projects\first\node_modules\jade\lib\parser.js:109:23) at Parser.peek (D:\Dropbox\Apps\mean_projects\first\node_modules\jade\lib\parser.js:86:17) at Parser.parse (D:\Dropbox\Apps\mean_projects\first\node_modules\jade\lib\parser.js:124:26) at Parser.parse (D:\Dropbox\Apps\mean_projects\first\node_modules\jade\lib\parser.js:138:24) at parse (D:\Dropbox\Apps\mean_projects\first\node_modules\jade\lib\jade.js:95:62) at Object.exports.compile (D:\Dropbox\Apps\mean_projects\first\node_modules\jade\lib\jade.js:152:9) at Object.exports.render (D:\Dropbox\Apps\mean_projects\first\node_modules\jade\lib\jade.js:256:15)

So, I take it the first or second thing is the issue, and the rest just trickles down to the parent elements, right? Somethings not right in my layouts/default.jade file. Everything is stock here, I haven't made any edits. Jade looks a lot like HAML... I think I'm going to like this!

Should I be having to start mongod manually? And to that extent, shouldn't that be starting somewhere in my project? I'm a bit confused on that. I'm actually jumping into this whole MEAN thing because I want to learn mongo and NoSQL, so I definitely need to get that squared away.

So, I'd like to get this up and running. Any other tips and tricks you can throw at me would be greatly appreciated!

like image 726
Dudo Avatar asked Dec 23 '13 05:12

Dudo


1 Answers

Latest version of Jade has a new doctype syntax. As it's written in Error message, you had to change in default.jade line with !!! to doctype, i.e.

doctype html
html(lang="en")
  head
    title= pageTitle
like image 90
Sergii Avatar answered Oct 04 '22 01:10

Sergii