Javascript Meteor:未捕获引用错误:未定义帐户
我正在学习MeteorJS教程,但是在调用'Accounts'对象方法'createUser'时,我遇到了一个奇怪的错误:Javascript Meteor:未捕获引用错误:未定义帐户,javascript,meteor,Javascript,Meteor,我正在学习MeteorJS教程,但是在调用'Accounts'对象方法'createUser'时,我遇到了一个奇怪的错误: Meteor: Uncaught ReferenceError: Accounts is not defined 我查阅了文档,Meteor提供了一个完整的帐户系统,用于在您的项目中安装Meteor。(). 这个错误的原因是什么?我找不到答案 我的代码: if (Meteor.isClient) { Template.login.creatingAccount
Meteor: Uncaught ReferenceError: Accounts is not defined
我查阅了文档,Meteor提供了一个完整的帐户系统,用于在您的项目中安装Meteor。(). 这个错误的原因是什么?我找不到答案
我的代码:
if (Meteor.isClient) {
Template.login.creatingAccount = function()
{
return Session.get('creatingAccount');
},
Template.login.events({
'click #loginform': function()
{
Session.set('creatingAccount', false);
},
'click #accountform': function()
{
Session.set('creatingAccount', true);
},
'click #createAccount': function(e,t)
{
//make sure to show the login form
Session.set('creatingAccount', false);
Accounts.createUser({
username: t.find('#username').value,
password: t.find('#password').value,
email: t.find('#email').value,
profile: {
name: t.find("#username").value,
email: t.find("#email").value
}
});
},
});
}
很可能其中一个帐户包没有添加到您的项目中。尝试:
$ meteor add accounts-password
您很可能没有添加除帐户基础之外的任何内容。这不会为您提供烘焙帐户包的功能。您需要添加帐户库,然后添加一个用于验证用户的解决方案。这里有很多选项,其中一些最流行的选项是:上面提到的帐户密码,还有facebook帐户、twitter帐户,还有一些第三方软件包,比如linkedin帐户,谢谢,解决了这个问题。我向后滚动,现在我明白发生了什么。我以为这个物体是流星本身的标准!