keystonejs / generator-keystone

⚠️ Archived - Legacy KeystoneJS project generator for Yeoman
MIT License
335 stars 143 forks source link

Error when handlebars used for generating #98

Closed olhapi closed 8 years ago

olhapi commented 9 years ago

Got an error after try to start (node keystone) keystone with fresh generated KeystoneJS and Handlebars as a templating language. With Jade everything works fine. Error: getaddrinfo ENOTFOUND at errnoException (dns.js:37:11) at Object.onanswer as oncomplete

olhapi commented 9 years ago

Got almost the same error when generating keystone only with User model. Error: getaddrinfo ENOTFOUND at errnoException (dns.js:37:11) at Object.onanswer as oncomplete

jeffreypriebe commented 9 years ago

The current generated KeystoneJS with Handlebars isn't all there. Specific issues related to enquiries (sounds like your issue may be broader, I'm tagging in one specific part of "handlebars generation" and how to resolve it):

  1. You may need to setup the templating engine yourself: https://github.com/keystonejs/keystone/issues/1441
  2. There is no enquiry-notification.hbs template (https://github.com/keystonejs/generator-keystone/pull/119)

I also encountered an issue where the path to the template is wrong. It may be the same https://github.com/keystonejs/generator-keystone/issues/110. If you have this issue then, in addition to ppiekarczyk's workaround on Issue 1441, you may also need to add to the keystone.Email options object passed in templateBasePath: path.normalize(path.join(__dirname, '..', 'templates', 'views', 'emails')). All together:

new keystone.Email({
    templateExt: 'hbs',
    templateEngine: require('express-handlebars'),
    templateName: 'enquiry-notification'
    templateBasePath: path.normalize(path.join(__dirname, '..', 'templates', 'views', 'emails')),