Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error on brand new express project doctype 5` is deprecated, you must now use `doctype html`

Created a brand new express.js project by running the following commands on a windows command prompt

npm install express -g 
express newproject
cd newproject
npm install
node app

I then open a browser window to http://localhost:3000/ and get the following error

    500 Error: c:\projects\newproject\views\index.jade:5<br/> 3| block content <br/> 4| h1= title <br/> > 5| p Welcome to #{title}<br/><br/>`doctype 5` is deprecated, you must now use `doctype html`
3| block content 
4| h1= title 
> 5| p Welcome to #{title}

`doctype 5` is deprecated, you must now use `doctype html`
at Object.Compiler.setDoctype (c:\projects\newproject\node_modules\jade\lib\compiler.js:68:13)
at Object.Compiler.visitDoctype (c:\projects\newproject\node_modules\jade\lib\compiler.js:312:12)
at Object.Compiler.visitNode (c:\projects\newproject\node_modules\jade\lib\compiler.js:210:37)
at Object.Compiler.visit (c:\projects\newproject\node_modules\jade\lib\compiler.js:197:10)
at Object.Compiler.visitBlock (c:\projects\newproject\node_modules\jade\lib\compiler.js:278:12)
at Object.Compiler.visitNode (c:\projects\newproject\node_modules\jade\lib\compiler.js:210:37)
at Object.Compiler.visit (c:\projects\newproject\node_modules\jade\lib\compiler.js:197:10)
at Object.Compiler.compile (c:\projects\newproject\node_modules\jade\lib\compiler.js:52:10)
at parse (c:\projects\newproject\node_modules\jade\lib\jade.js:96:23)
at Object.exports.compile (c:\projects\newproject\node_modules\jade\lib\jade.js:152:9)
like image 785
Bryan Focht Avatar asked Jan 03 '14 17:01

Bryan Focht


3 Answers

To fix your current project and any projects you build with the current version of Express, go to your layout.jade file and change the first line to: doctype html (the second line should read: html)

The issue with is known and has been resolved so it will not be an issue in a future version of Express. https://github.com/visionmedia/express/pull/1875

like image 117
canadaCoder Avatar answered Nov 19 '22 20:11

canadaCoder


Use :

doctype html
html(lang="en")

like image 23
Girish Kumar Avatar answered Nov 19 '22 20:11

Girish Kumar


change "doctype 5" to "doctype html" on line 1 of views/layout.jade for your brand new project.

like image 1
Rob Avatar answered Nov 19 '22 21:11

Rob