Template not defined errors

Help. My application is crashing. I am getting the following errors:

=> Modified – restarting.
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.
I20151230-01:56:21.320(-5)? Hello World
W20151230-01:56:21.325(-5)? (STDERR) C:\Users\tony.holland\AppData\Local.meteor
\packages\meteor-tool\1.1.10\mt-os.windows.x86_32\dev_bundle\server-lib\node_mod
ules\fibers\future.js:245
W20151230-01:56:21.325(-5)? (STDERR)
^
W20151230-01:56:21.326(-5)? (STDERR) ReferenceError: Template is not defined
W20151230-01:56:21.326(-5)? (STDERR) at leaderboard.old.js:4:1
W20151230-01:56:21.326(-5)? (STDERR) at C:\Meteor\leaderboard.meteor\local
build\programs\server\boot.js:242:10
W20151230-01:56:21.325(-5)? (STDERR)
W20151230-01:56:21.326(-5)? (STDERR) at Array.forEach (native)
W20151230-01:56:21.327(-5)? (STDERR) at C:\Meteor\leaderboard.meteor\local
build\programs\server\boot.js:137:5
W20151230-01:56:21.325(-5)? (STDERR)
throw(ex);
W20151230-01:56:21.326(-5)? (STDERR) at Function..each..forEach (C:\Users
tony.holland\AppData\Local.meteor\packages\meteor-tool\1.1.10\mt-os.windows.x86
_32\dev_bundle\server-lib\node_modules\underscore\underscore.js:79:11)
W20151230-01:56:21.326(-5)? (STDERR) at C:\Meteor\leaderboard.meteor\local
build\programs\server\app\leaderboard.old.js:21:4

//

My “leaderboard.html” is as follows:

Leaderboard

Leaderboard

{{> leaderboard}}
    {{#each player}}
  • {{name}}: {{score}}
  • {{/each}}

//

My “leaderboard.js” is as follows:

if(Meteor.isClient){
Template.leaderboard.helpers({
‘player’: function(){
return PlayersList.find()
}
});
}

if(Meteor.isServer){
// thiPlayersList = new Mongo.Collection(‘players’);
s code only runs on the server
}

this issue can come from anywhere. Is your leaderboard a template at least ? Does the template have the correct name ?

<template name="leaderboard">
// your content
</template>

Hi Karthons. How are you? Thank you for your reply.

My leaderboard.js and leaderboard.html is attached (https://github.com/realdavidturnbull/leaderboard3).

The template keyword is referencing the same name of the template that I have created as follows:

// leaderboard.js

if(Meteor.isClient){
Template.leaderboard.helpers({
‘player’: function(){
return PlayersList.find()
}
});
}

if(Meteor.isServer){
// thiPlayersList = new Mongo.Collection(‘players’);
s code only runs on the server
}

// leaderboard.html
//
//
// Leaderboard
//
//
//

Leaderboard


// {{> leaderboard}}
//
//
//
//

    // {{#each player}}
    //
  • {{name}}: {{score}}

  • // {{/each}}
    //

//
//

When I try to take an deprecated approach for creating the same helper function, I get errors as well.

My Javascript file (using deprecated approach) is as follows:

if(Meteor.isClient){
Template.leaderboard.player = function(){
return “Some other text”
}
});

My leaderboard.html is as follows:

//
// Leaderboard
//
//
//
//

Leaderboard


// {{> leaderboard}}
//
//
// {{player}}
//

Problem solved !! I was able to solve the problem by stopping my meteor server and re-starting my meteor server.

The leaderboard application now works.

Thank You