egg: Can't find viewEngine for /.../app/view/index.tpl

  • Node Version: 7.6.0
  • Egg Version: 1.0.0-rc.1
  • Plugin Name: egg-view-nunjucks
  • Plugin Version: 2.0.0
  • Platform: macOS 10.12.3

My configs

// {app_root}/config/plugin.js
exports.nunjucks = {
  enable: true,
  package: 'egg-view-nunjucks',
};
exports.view = {
  defaultViewEngine: 'nunjucks',
  mapping: {
    '.tpl': 'nunjucks',
  },
};

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 18 (15 by maintainers)

Commits related to this issue

Most upvoted comments

module.exports = appInfo => {
  const config = {};

  config.keys = appInfo.name + '_1493400288522_208';
  config.view = {
    defaultViewEngine: 'nunjucks',
    mapping: {
      '.tpl': 'nunjucks',
    },
  };

  return config;
};

这样写就好了

写错配置…

@johnnychen 不是看这个 key, 这个是 plugins.nunjucks, 要看 config.viewconfig.nunjucks