I had a project worked well with meteor 1.1.0.3
I did new installation for meteor to update it to version 1.2
I created a new project, copied all files of my old project
Then I did meteor add
for all of the packages I used in the old project
After that I did meteor
I got this problem:
I20150925-14:58:48.269(2)? Exception while invoking method 'addUser' ReferenceError: check is not defined
I20150925-14:58:48.269(2)? at [object Object].Meteor.methods.addUser (server/models/users.js:4:3)
I20150925-14:58:48.269(2)? at maybeAuditArgumentChecks (livedata_server.js:1692:12)
I20150925-14:58:48.269(2)? at livedata_server.js:708:19
I20150925-14:58:48.269(2)? at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
I20150925-14:58:48.270(2)? at livedata_server.js:706:40
I20150925-14:58:48.270(2)? at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
I20150925-14:58:48.270(2)? at livedata_server.js:704:46
I20150925-14:58:48.270(2)? at tryCallTwo (/home/ahmed/.meteor/packages/promise/.0.4.8.1euaa8x++os+web.browser+web.cordova/npm/node_modules/meteor-promise/node_modules/promise/domains/core.js:45:5)
I20150925-14:58:48.270(2)? at doResolve (/home/ahmed/.meteor/packages/promise/.0.4.8.1euaa8x++os+web.browser+web.cordova/npm/node_modules/meteor-promise/node_modules/promise/domains/core.js:171:13)
I20150925-14:58:48.271(2)? at new Promise (/home/ahmed/.meteor/packages/promise/.0.4.8.1euaa8x++os+web.browser+web.cordova/npm/node_modules/meteor-promise/node_modules/promise/domains/core.js:65:3)
addUser is a method allow admin to add users, and It has those checks:
Meteor.methods({
addUser: function(userAttributes) {
check(Meteor.userId(), String);
check(userAttributes, {
username: String,
password: String
});
var currentUserId = Meteor.user()._id;
var adminId = Meteor.users.findOne({username: 'admin'});
if (currentUserId === adminId._id) {
Accounts.createUser(userAttributes);
return true;
} else {
console.log("Someone - not permitted - tryied to create user.");
return false
}
}
})
Meteor.users.allow({
insert: function(userId, doc) {
var username = Meteor.user().username;
return username === "admin"
}
})
Some told me that he hadn’t get the ‘check’ issue.