2015-10-06 88 views
0

刪除使用帳戶包郵當嘗試使用在服務器端下面列出的基本賬戶的方法之一,我總是得到以下類型的錯誤:不能流星

TypeError: Object # has no method 'removeEmail'

服務器的方法:

  • Accounts.addEmail()
  • Accounts.removeEmail()
  • Accounts.findUserByUsername()
  • Accounts.findUserByEmail()

我已經從應用程序內,並從殼REPL嘗試。

帳戶相關的軟件包使用:

  • 流星平臺
  • 帳戶密碼
  • 帳戶,Facebook的
  • 聖保利:帳戶 - LinkedIn
  • 賬戶,Twitter的
  • splendido:accounts-emails-field
  • 帳戶基
  • alanning:角色
+0

只是想在這裏補充我5毛錢,我也遇到了類似的問題,仍然沒有想辦法。似乎它不可用,如果你在像'onCreateUser'這樣的回調中運行它。當在服務器端運行(而不是發佈回調)時,您要查找的部分是「AccountServer」。 文檔說你可以在AccountsCommon上創建一個子類並實現你自己的userId(),但是不知道如何...... 你可以看到這裏發生了什麼https://github.com/meteor/meteor /blob/master/packages/accounts-base/accounts_server.js#L68 –

回答

0

你可能運行流星1.2之前流星版本。我想認爲你提到的所有功能都是在1.2中加入的。要檢查您的流星版本,運行:

meteor --version 

如果這是沒有問題的,請提供導致你提到的錯誤的確切代碼。

僅供參考,下面顯示的是,在我的流星存在1.2安裝與你提到的包那些方法:

[[email protected] test-app]$ meteor --version 
Meteor 1.2.0.2 
[[email protected] tmp]$ meteor create test-app 
Created a new Meteor app in 'test-app'.  

To run your new app:       
    cd test-app         
    meteor          

If you are new to Meteor, try some of the learning resources here: 
    https://www.meteor.com/learn     

[[email protected] tmp]$ cd test-app 

#### Note "meteor add accounts-password" also works instead of this next line: 

[[email protected] test-app]$ meteor add accounts-password accounts-facebook pauli:accounts-linkedin accounts-twitter splendido:accounts-emails-field accounts-base alanning:roles 

Changes to your project's package version selections: 

accounts-base     added, version 1.2.1 
accounts-facebook    added, version 1.0.6 
accounts-oauth     added, version 1.1.7 
accounts-password    added, version 1.1.3 
accounts-twitter     added, version 1.0.6 
alanning:roles     added, version 1.2.14 
ddp-rate-limiter     added, version 1.0.0 
email       added, version 1.0.7 
facebook       added, version 1.2.2 
localstorage      added, version 1.0.5 
npm-bcrypt      added, version 0.7.8_2 
oauth       added, version 1.1.6 
oauth1       added, version 1.1.5 
oauth2       added, version 1.1.5 
pauli:accounts-linkedin   added, version 1.1.2 
pauli:linkedin     added, version 1.1.2 
rate-limit      added, version 1.0.0 
service-configuration   added, version 1.0.5 
sha        added, version 1.0.4 
splendido:accounts-emails-field added, version 1.2.0 
srp        added, version 1.0.4 
twitter       added, version 1.1.5 


accounts-password: Password support for accounts 
accounts-facebook: Login service for Facebook accounts 
pauli:accounts-linkedin: Accounts service for LinkedIn accounts 
accounts-twitter: Login service for Twitter accounts 
splendido:accounts-emails-field: Adds to the user obj a `registered_emails` 
field containing 3rd-party account service emails. 
accounts-base: A user account system   
alanning:roles: Authorization package for Meteor 
[[email protected] test-app]$ meteor &   
[1] 21185 
[[[[[ ~/tmp/test-app ]]]]]      

=> Started proxy.        
=> Started MongoDB.       
=> Started your app.       

=> App running at: http://localhost:3000/ 
I20151007-23:49:34.554(-7)? ** You've set up some data subscriptions with Meteor.publish(), but 
I20151007-23:49:34.555(-7)? ** you still have autopublish turned on. Because autopublish is still 
I20151007-23:49:34.555(-7)? ** on, your Meteor.publish() calls won't have much effect. All data 
I20151007-23:49:34.555(-7)? ** will still be sent to all clients. 
I20151007-23:49:34.555(-7)? ** 
I20151007-23:49:34.556(-7)? ** Turn off autopublish by removing the autopublish package: 
I20151007-23:49:34.556(-7)? ** 
I20151007-23:49:34.556(-7)? ** $ meteor remove autopublish 
I20151007-23:49:34.556(-7)? ** 
I20151007-23:49:34.556(-7)? ** .. and make sure you have Meteor.publish() and Meteor.subscribe() calls 
I20151007-23:49:34.556(-7)? ** for each collection that you want clients to see. 
I20151007-23:49:34.556(-7)? 

[[email protected] test-app]$ meteor shell 

Welcome to the server-side interactive shell! 

Tab completion is enabled for global variables. 

Type .reload to restart the server and the shell. 
Type .exit to disconnect from the server and leave the shell. 
Type .help for additional help. 

> Accounts.removeEmail 
[Function] 
> Accounts.addEmail 
[Function] 
> Accounts.findUserByUsername 
[Function] 
> Accounts.findUserByEmail 
[Function] 
+0

你當然是對的。這是原因。謝謝 – nexus