Bry*_*cht 26 doctype node.js express
通过在Windows命令提示符下运行以下命令来创建一个全新的express.js项目
npm install express -g
express newproject
cd newproject
npm install
node app
Run Code Online (Sandbox Code Playgroud)
然后我打开浏览器窗口http://localhost:3000/并获得以下错误
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)
Run Code Online (Sandbox Code Playgroud)
can*_*der 49
要修复当前项目以及使用当前版本的Express构建的任何项目,请转到layout.jade文件并将第一行更改为:doctype html(第二行应为:html)
问题已知且已经解决,因此在将来的Express版本中不会出现问题. https://github.com/visionmedia/express/pull/1875
| 归档时间: |
|
| 查看次数: |
13769 次 |
| 最近记录: |