通过全新的 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/