2016-03-23 30 views
3

有了一個全新的Windows安裝流星的和最簡單的包,我越來越AccountsTemplates沒有定義

ReferenceError: AccountsTemplates is not defined

我試圖使用postSignUpHook功能,像這樣 (在基本目錄中嘗試以及/服務器/)

AccountsTemplates.configure({ 
    postSignUpHook: myPostSubmitFunc 
}); 

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

這裏是已使用流星安裝版本上安裝

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假設來自帳戶基地,但我很難找到它創建的位置。

另外如果我沒有記錯的話,當你得到像這樣的引用錯誤時,它可能是一個不兼容的軟件包與其他地方無關的問題?我怎麼去調試這裏發生的事情?

+1

您需要使用'useraccounts:鐵routing'或'useraccounts :flow-routing'包,以便使用'AccountsTemplates'。 [參考文獻](https://github.com/meteor-useraccounts/core/blob/master/Guide.md#routing)。 –

回答

1

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

我應該看的是docs.meteor.com,在帳戶部分。

具體來說,我想我會使用Accounts.onLogin添加角色後創建一個新的用戶。我無法使用AccountsServer#onCreateUser,因爲userId在此時尚未生成。

(該docs.meteor.com實際上有一個看似錯誤的AccountsCommon#onLogin,注意的是,該方法不上AccountsServer存在)