【已解决】express用jade一个hello world 但是遇到点问题
发布于 3个月前 作者 zhishaofei3 345 次浏览 来自 问答

大家好,我在用express和jade做一个hello world 但是遇到点问题 不知道怎么错的。 我的jade,都是用的tab键来空格。我不知道问题出在哪里

1.jpg

控制台输出: listening on port 3000 访问页面后 输出: Error: No default engine was specified and no extension was provided. at new View (e:\hellword\node_modules\express\lib\view.js:41:42) at Function.app.render (e:\hellword\node_modules\express\lib\application.js:509:12) at ServerResponse.res.render (e:\hellword\node_modules\express\lib\response.js:900:7) at e:\hellword\app.js:7:6 at Layer.handle [as handle_request] (e:\hellword\node_modules\express\lib\router\layer.js:82:5) at next (e:\hellword\node_modules\express\lib\router\route.js:100:13) at Route.dispatch (e:\hellword\node_modules\express\lib\router\route.js:81:3) at Layer.handle [as handle_request] (e:\hellword\node_modules\express\lib\router\layer.js:82:5) at proto.handle.c (e:\hellword\node_modules\express\lib\router\index.js:234:24) at Function.proto.process_params (e:\hellword\node_modules\express\lib\router\index.js:312:12)

我的目录结构和package.json xx.jpg

2 回复
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');****
回到顶部