Meteor.users is undefined

I got an error saying

TypeError: Cannot read property ‘insert’ of undefined

when I run my application, and I discovered that the undefined thing mentioned before is “Meteor.users”

as it’s used to insert some data to the database like so (that is the cause of the error):

var tomId = Meteor.users.insert({username: “Tom”,
profile: { name: ‘Tom Coleman’, username:“Tom” }
});

and I don’t know how to make it work normally without being undefined

any help ?

Have you installed an accounts package?

2 Likes