Search code examples
meteormeteor-accounts

Meteor: Cannot read property 'config' of undefined


I'm trying to implement the accounts-ui in a mobile angular-meteor app. I have all the dependencies installed, and I'm trying to setup the Accounts.ui.config with the following code:

   import { Accounts } from 'meteor/accounts-base';

   Accounts.ui.config({
     passwordSignupFields: 'USERNAME_AND_EMAIL'
   });

But when I try to run the app, I get the following error:

TypeError: Cannot read property 'config' of undefined
    at meteorInstall.server.auth.js (server/auth.js:4:1)
    at fileEvaluate (packages/modules-runtime/.npm/package/node_modules/install/install.js:153:1)
    at require (packages/modules-runtime/.npm/package/node_modules/install/install.js:82:1)
    at server/publications.js:124:1
    at /home/ubuntu/workspace/musiker/.meteor/local/build/programs/server/boot.js:297:10
    at Array.forEach (native)
    at Function._.each._.forEach (/home/ubuntu/.meteor/packages/meteor-   tool/.1.4.0.hylsrj++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
    at /home/ubuntu/workspace/musiker/.meteor/local/build/programs/server/boot.js:133:5

I thought maybe I need to import accounts-ui for the page, but the docs clearly show importing the account-base. I also tried importing the accouns-ui and I still got the same error.

Thank!

-Erick


Solution

  • You need to add the config on client side code :

    import { Accounts } from 'meteor/accounts-base';
    
    Accounts.ui.config({
      passwordSignupFields: 'USERNAME_ONLY',
    });
    

    Have a look here for more details.