0

I'm new to Express and Jade and I'm getting the following error when rendering a view.

TypeError: Property 'engine' of object # is not a function

My configuration is as follows:

var express = require('express');
var http = require('http');
var app = express();
app.set("views", __dirname + "/../views");
app.set("view engine", "jade");

The app crashes on the following rendering function:

app.get("/", function(request, response) {
  response.render("game.jade", { message: "this is a variable" });
});

The view exists in the views directory and contains just some simple jade test html.

Any idea how to solve this?

4

1 回答 1

1

如果您在实际 Jade 包(和/或您尚未安装它)之前正在加载(并返回对象而不是函数)的某处有一个名为jade.js(或)的文件,我可以重现该问题。jade/index.js$NODE_PATH

您可以像这样找到加载的文件:

$ node -e 'console.log(require.resolve("jade"))'
于 2013-10-19T20:02:35.233 回答