nodejs+expressのjadeでエラーを回避する
December 30, 2013,
tags:
express
jade
nodejs
express@3.4.7とjade@1.0.1の組み合わせで久しぶりにツールを作ろうと思ったんですが、なぜかしらないけど500エラーが・・・
単純expressのデフォルトでhello world出そうと思っただけなんですけどね。
エラーメッセージは以下のようになっています。
500 Error: /var/www/test/nodejs/acs/views/index.jade:5<br /> 3| block content<br /> 4| h1= title<br /> > 5| p Welcome to "test"<br /><br />`doctype 5` is deprecated, you must now use `doctype html`
これをみるとdoctype 5ってのが単純にだめみたい。
どうやらviews/layout.jadeのなかに記載されているdoctype宣言がおかしいと。
で、layout.jadeの中身は以下のようになっています。
doctype 5
html(lang="ja")
head
title= title
link(rel='stylesheet', href='/stylesheets/style.css')
body
block content
まあエラーメッセージに
「`doctype 5` is deprecated, you must now use `doctype html`」
ってかいてありますよね。
ってこは単純にdoctype 5はdeprecatedなわけで、doctype htmlって書き換えればいいわけですよ。
そう、こんな感じにね。
doctype html
html(lang="ja")
head
title= title
link(rel='stylesheet', href='/stylesheets/style.css')
body
block content
これexpressにpull requestでもおくったほうがいいのかなぁ。