Error with simple helper #33

olalonde opened this Issue Oct 9, 2012 · 12 comments


None yet
3 participants

olalonde commented Oct 9, 2012

I'm getting a bug with that helper:

hbs.registerHelper('fromnow', function(val) {
    return 'test';

and in my view:

{{fromnow user}}

The error is:

    throw new Error("Could not find property '" + arg + "'");
Error: Could not find property 'fromnow'

defunctzombie commented Oct 9, 2012

Are you registering the helper before rendering the view? Can you provide a simple example showing the bug.

olalonde commented Oct 9, 2012

Yes my code flow is a bit like this:

var hbs = require('hbs');

// ...

hbs.registerHelper('fromnow', function(val) {
  return 'test';

// ....
app.set('views', __dirname + '/views');
app.set('view engine', 'hbs');

// ... then in some route

res.render('view', {user: {name:'aa'}});

My views work fine with the builtin helpers but my own registered helpers always throw that error :(


defunctzombie commented Oct 9, 2012

Can you tell me what version of hbs you have installed and what version of handlebars?

olalonde commented Oct 9, 2012

├─┬ hbs@1.0.5
│ └─┬ handlebars@1.0.5beta

olalonde commented Oct 9, 2012



olalonde commented Oct 9, 2012

been stuck on this for almost 2 hours, do you have any idea of what might be the problem?


defunctzombie commented Oct 9, 2012

No, I do not. I would recommend removing anything else in the app and creating a minimal broken example with nothing extra.

olalonde commented Oct 9, 2012

Damn it, the bug was cause by this little piece of code:

if(app.get('env') != 'production') {
  // todo: make last_req available
  console.log('You can now type Javascript expressions in the interactive REPL.');
  console.log('Some useful expressions:');
  repl.start('>>> '.green);

I still can't figure what might be the problem here :( At least I found the bug

Just an FYI, I'm running into this now too.

Some details on my bug. Here is my app.js. You can see I'm regstering the helper (using a simple string for now in the result).

And here is my view:

Sorry - it must have been a typo. It is working ok now.

Heh, I see it. I called dateHelper in my view, but it was dateFormat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment