Nareshy
Nareshy

Reputation: 133

create user method error in `meteor Js`?

I am new to meteor Js, i had develop the meteor app the below error is came in server console please verify my code and suggest me how to solve the error.HERE IS MY SERVER JS AND CLIENT JS IS THERE WHERE I DID A MISTAKE PLEASE VERIFY AND GIVE ME SUGGESTION.

eRROR:
TypeError: Object #<Object> has no method 'createUser'
SERVER JS:
if (Meteor.isServer) 
{

  Meteor.startup(function () 
  {
    // code to run on server at startup
    if ( Meteor.users.find().count() === 0 )
      {
     Accounts.createUser
  ({
        username: 'admin',
        email: '[email protected]',
        password: '000000',
        profile: 
        {
            first_name: 'admin',
            last_name: 'admin',
            company: '3CubeTech',
        }
      }) //Added close parenthesis.
    }   
  });
}
cLIENT js:
Template.body.events
      ({
        'submit #login-form' : function (e,t)
     {
          /* template data, if any, is available in 'this'*/
          if (typeof console !== 'undefined')

        console.log("You pressed Login the button");
         e.preventDefault();
      /*retrieve the input field values*/
         var username = t.find('#username').value
         , password = t.find('#password').value;
          console.log(password);



       Meteor.loginWithPassword(username, password, function (err)
        {
        if (err) 
        {
          console.log(err);
          alert(err.reason);
          Session.set("loginError", true);
         }
         else
         {
        console.log(" Login Success ");
        console.log( ">>>>>>>>>>>>>>>>>>>>>>> userid="+Meteor.userId() ); 
        var adminUser =  Meteor.users.findOne({username:"admin"});
                console.log( ">>>>>>>>>>>>>>>>>>>>>>> adminUser()="+adminUser +" AND "+adminUser._id);  

         }
        });
        }
      });

Upvotes: 1

Views: 715

Answers (1)

Philipp Woe
Philipp Woe

Reputation: 115

Run mrt test-packages For me it turned out, that I had to run mrt add accounts-password

Upvotes: 1

Related Questions