gpt4 book ai didi

node.js - 全新 express 项目 doctype 5` is deprecated, you must now use ` doctype html` 上的错误

转载 作者:IT老高 更新时间:2023-10-28 22:01:45 25 4
gpt4 key购买 nike

通过在 windows 命令提示符下运行以下命令创建了一个全新的 express.js 项目

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

然后我打开浏览器窗口到 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)

最佳答案

要修复您当前的项目以及您使用当前版本的 Express 构建的任何项目,请转到您的 layout.jade 文件并将第一行更改为:doctype html(第二行应为:html)

这个问题是已知的并且已经解决,因此在未来的 Express 版本中不会出现问题。 https://github.com/visionmedia/express/pull/1875

关于node.js - 全新 express 项目 doctype 5` is deprecated, you must now use ` doctype html` 上的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20909817/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com