meteor - AccountsTemplates 未定义

标签 meteor

通过全新的 Windows 安装 Meteor 和最简单的软件包,我得到了

ReferenceError: AccountsTemplates is not defined

我正在尝试使用 postSignUpHook 功能,如下所示 (在基本目录以及/server/中尝试过)

AccountsTemplates.configure({
  postSignUpHook: myPostSubmitFunc 
});

var myPostSubmitFunc = function(userId, info) {
  console.log("new user " + userId);
}

这里是使用meteor install安装的版本

meteor list
accounts-base         1.2.2  A user account system
accounts-password     1.1.4  Password support for accounts
accounts-ui           1.1.6  Simple templates to add login widgets to an app
alanning:roles        1.2.15  Authorization package for Meteor
blaze-html-templates  1.0.1  Compile HTML templates into reactive UI with
  Meteor Blaze
ecmascript            0.1.6* Compiler plugin that supports ES2015+ in all 
  .js files
es5-shim              4.1.14  Shims and polyfills to improve ECMAScript 5     
  support
insecure              1.0.4  (For prototyping only) Allow all database     
  writes from the client
jquery                1.11.4  Manipulate the DOM using CSS selectors
meteor-base           1.0.1  Packages that every Meteor app needs
mobile-experience     1.0.1  Packages for a great mobile user experience
mongo                 1.1.3  Adaptor for using MongoDB and Minimongo over     
  DDP
session               1.1.1  Session variable
standard-minifiers    1.0.2  Standard minifiers used with Meteor apps by     
  default.
tracker               1.0.9  Dependency tracker to allow reactive callbacks

据我所知,AccountsTemplates 应该来自帐户库,但我很难真正找到它的创建位置。

另外,如果我没记错的话,当您遇到这样的丢失引用错误时,可能是其他不相关的地方存在不兼容的包的问题?我该如何调试这里发生的事情?

最佳答案

我想我很困惑,因为guide.meteor.com 假设使用 useraccounts:flow-routing。

我应该查看帐户部分的 docs.meteor.com。

具体来说,我想我会在创建新用户后使用 Accounts.onLogin 添加角色。我无法使用 AccountsServer#onCreateUser,因为此时尚未生成 userId。

(docs.meteor.com实际上有一个看似错误的AccountsCommon#onLogin,请注意,该方法在AccountsServer上不存在)

关于meteor - AccountsTemplates 未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36168563/

相关文章:

sorting - meteor 排序集合随机

arrays - Meteor、MongoDB通过订阅获取数组的一部分

android - cordova/phongap meteor build for android 中的后退按钮不会持续关闭应用程序

performance - meteor :帐户登录链接需要时间来加载

mysql - meteor :无法在我的 meteor 应用程序中安装 mysql

javascript - 如何将 sdtout 从服务器返回到字符串内的客户端?

javascript - meteor 在模板空格键中显示数组的第一个元素

javascript - meteor.js 和backbone.js 是互补的吗?

meteor - Meteor 的 MergeBox 是否会在客户端之间复制公共(public)数据?

javascript - Cloudinary直接上传,带有上传预设和Meteor.js