I want to create an admin user if no users exist. I tried it on a js file inside the server folder
Meteor.startup(function () {
if(!Meteor.users.find().count()) {
var options = {
username: 'admin',
password: 'default-password',
email: 'admin@example.com'
};
Accounts.createUser(options);
}
});
This is the error that meteor show on the console
Error
at app/packages/livedata/livedata_common.js:143:26
at /Users/camilo/Documents/Proyectos/IM/interno/.meteor/local/build/server/server.js:282:7
at Array.forEach (native)
at Function._.each._.forEach (/Users/camilo/.meteorite/meteors/meteor/meteor/0ffea1c4c308ed24906984f99b13b8fca5a0956c/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
at run (/Users/camilo/Documents/Proyectos/IM/interno/.meteor/local/build/server/server.js:227:7)
=> Exited with code: 1
I'm doing something wrong or this is a meteor bug?
I'm using meteor 0.6.1 and node.js 0.9.9