Can't find ViewEngine "nunjucks"
See original GitHub issue2017-03-06 21:48:50,902 INFO 86405 [master] egg started on http://127.0.0.1:7001 (1243ms)
2017-03-06 21:48:55,588 ERROR 86418 [-/::1/-/8ms GET /] nodejs.AssertionError: Can't find ViewEngine "nunjucks"
at ContextView.[contextView#getViewEngine] (/Users/guomiaoyou/github/dumplings/node_modules/egg-view/lib/context_view.js:91:5)
at ContextView.[contextView#render] (/Users/guomiaoyou/github/dumplings/node_modules/egg-view/lib/context_view.js:72:39)
at next (native)
at onFulfilled (/Users/guomiaoyou/github/dumplings/node_modules/co/index.js:65:19)
name: 'AssertionError'
actual: undefined
expected: true
operator: '=='
message: 'Can\'t find ViewEngine "nunjucks"'
generatedMessage: false
pid: 86418
hostname: guomiaoyoudeMacBook-Pro.local
config/config.default.js
配置如下
'use strict';
const path = require('path')
module.exports = appInfo => {
const config = {
view:{
root: path.join(appInfo.baseDir, 'app/view'),
defaultExtension: '.html',
defaultViewEngine: 'nunjucks',
mapping: {'.nj':'nunjucks'},
},
security: {
csrf: {
enable:false,
},
},
};
config.keys = appInfo.name + '778477';
return config;
};
home.js
module.exports = function*() {
const result = {
title: 'dumplings',
};
yield this.render('index.html', result);
};
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
View Template Rendering - Egg - Eggjs.org
egg-view won't search all directories again for the same template path. mapping and defaultViewEngine. Every view engine has a view engine name ...
Read more >nunjucks: Error: template not found, Problems with directories
I get the error message that the template was not found. Error: template not found: D:\Development\src\nunjucks\pages\templates\text.njk.
Read more >Nunjucks
Rich Powerful language with block inheritance, autoescaping, macros, asynchronous control, and more. Heavily inspired by jinja2; Fast & Lean High-performant ...
Read more >玩egg的一起交流交流啊,怎么感觉人这么少? - CNode技术社区
我按照官网快速开始教程做遇到错误,提示can not find viewEngine 自豪地采用CNodeJS ionic · atian25 6楼•6 年前. @bendise 看看plugin.js 的配置,是不是nunjuck ...
Read more >eggjs/egg/cn - Gitter
TypeError: Cannot read property 'index' of undefined ... 请教一下,egg配置nunjucks后,报错Can't find ViewEngine "nunjucks".
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@778477 帮忙同步下文档呗,http://eggjs.org/zh-cn/intro/quickstart.html#模板渲染 这里会掉坑的
楼主怎么解决的??