【问题标题】:expressJS/Node app running errorexpressJS/Node 应用程序运行错误
【发布时间】:2014-01-13 22:03:48
【问题描述】:

我使用 expressJs,今天我遇到了错误。我重新安装 node.js 和 expressJs 但我的问题没有解决。当我使用并运行自动生成的快速应用程序或运行我的其他应用程序时,我遇到了这样的错误。

本地服务器错误

 500 Error: C:\express-app\test\test\views\layout.jade:1<br/> > 1| doctype 5 <br/> 2| html <br/> 3| head <br/> 4| title= title <br/><br/>`doctype 5` is deprecated, you must now use `doctype html`

screenShots CMD

【问题讨论】:

  • 你能把你的layout.jade代码放上来吗?
  • @FÔx Gênki 此代码由 express doctype 5 html head title= title link(rel='stylesheet', href='/stylesheets/style.css') body block content自动生成
  • @H.T 错误输出为您提供解决方案。使用doctype html 而不是doctype 5。您已安装的jade 版本不支持后者(即deprecated)。
  • @Jonathan Lonowski 我改变了它,但我有问题。 以上代码通过 express 命令自动生成
  • @H.T 它可能是为jade0.x 版本生成的。但是,由于您安装了1.x,因此该行不再有效。另请注意,Express won't be including the command 继续前进。

标签: node.js express


【解决方案1】:

错误信息说明了如何解决它:

`doctype 5` is deprecated, you must now use `doctype html`

只需将_layout.jade开头的5更改为html即可:

doctype html
html
  head
    title= title
# ...

这是release of jade@1.0.0 所做的许多更改之一:

  • 删除 5 的快捷方式 html doctype (@ForbesLindesay)

【讨论】:

猜你喜欢
  • 2021-07-31
  • 2018-01-25
  • 2022-11-12
  • 1970-01-01
  • 1970-01-01
  • 2018-10-09
  • 1970-01-01
  • 1970-01-01
  • 2013-02-09
相关资源
最近更新 更多