Cannot read property 'config' of undefined in accounts-ui

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

   import { Meteor } from 'meteor/meteor';
   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

Any idea why I could get this error and how to fix it?

Thank!

-Erick

accounts-ui is a separate package?

Yes it is, and I have it installed. You can read the docs here: http://docs.meteor.com/api/accounts.html#Accounts-ui-config

But I didn’t see you importing it …

It doesn’t need to be. The config is setup in the accounts-base. If you look at the docs, it specifically the account-base:
import { Accounts } from 'meteor/accounts-base'

Indeed. When I copy your code it works and I don’t see an error message.

Edit: this only works on the client docs

1 Like

Ah, well, that explains it. Thanks for checking it out for me. :smile:

import { Accounts } from ‘meteor/accounts-base’;

Accounts.ui.config({
passwordSignupFields: ‘USERNAME_ONLY’,
});

TypeError: Cannot read property ‘config’ of undefined
W20170328-10:41:22.068(8)? (STDERR) at meteorInstall.lib.accounts-config.js (lib/accounts-config.js:3:1)

I am follow the meteor tutorial example add user, but get a error.

This should only run on the client.

@jamgold thanks, i change the folder and it worked.