Meteor 0.9.1: ReferenceError: SimpleSchema is not defined - meteor

After deciding to create a new project and start fresh and then checkout the code for a separate project (that was in a working state) I'm getting the following error with simple-schema. This schema was working so its likely that an update has broken it in some respect.
Can anyone suggest what I need to do to sort this?
Terminal output:
$ meteor
[[[[[ ~/puzzle ]]]]]
=> Started proxy.
=> Started MongoDB.
W20140906-10:30:37.252(-7)? (STDERR)
W20140906-10:30:37.339(-7)? (STDERR) /home/me/.meteor/packages/meteor-tool/.1.0.27.11fuo6h++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/dev_bundle/lib/node_modules/fibers/future.js:173
W20140906-10:30:37.339(-7)? (STDERR) throw(ex);
W20140906-10:30:37.340(-7)? (STDERR) ^
W20140906-10:30:37.340(-7)? (STDERR) ReferenceError: SimpleSchema is not defined
W20140906-10:30:37.341(-7)? (STDERR) at app/lib/schema-Account-Type.js:5:26
W20140906-10:30:37.341(-7)? (STDERR) at app/lib/schema-Account-Type.js:25:3
W20140906-10:30:37.341(-7)? (STDERR) at /home/me/puzzle/.meteor/local/build/programs/server/boot.js:161:10
W20140906-10:30:37.342(-7)? (STDERR) at Array.forEach (native)
W20140906-10:30:37.342(-7)? (STDERR) at Function._.each._.forEach (/home/graeme/.meteor/packages/meteor-tool/.1.0.27.11fuo6h++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
W20140906-10:30:37.342(-7)? (STDERR) at /home/me/puzzle/.meteor/local/build/programs/server/boot.js:82:5
=> Exited with code: 8
Schema:
AccountType = new Meteor.Collection("AccountType");
Schema = {};
Schema.AccountType = new SimpleSchema({
accountType: {
type: String,
allowedValues: ['test', 'live']
},
createdBy: {
type: String,
autoValue: function(){ return this.userId }
}
});
SimpleSchema.debug = true;
AccountType.attachSchema(Schema.AccountType);

I had the same issue. Resolved by the following steps - installing SimpleSchema:
Try installing / reinstalling: aldeed:simple-schema.
Looking at how to install packages: https://guide.meteor.com/using-npm-packages.html
So, I found https://atmospherejs.com/aldeed/simple-schema on Atmosphere to get the correct install script:
meteor add aldeed:simple-schema
(Reference)

Fixed it, ended up having to create a new Meteor app though.
https://github.com/aldeed/meteor-simple-schema/issues/147

Related

Meteor email error for gmail server

My server.js file contains the following code segments which should configure a gmail address and send an email.
Meteor.startup(() => {
// code to run on server at startup
process.env.MAIL_URL = 'smtps://email_address#gmail.com:password_without_special_keys#smtp.gmail.com:465';
Email.send({
from: "from_adddress#gmail.com",
to: "to_address#gmail.com",
subject: "Meteor Can Send Emails via Gmail",
text: "Its pretty easy to send emails via gmail."
})
});
Shouldn't my meteor app send an email when i run the app with the command
meteor
??
But it is providing the following errors. What's wrong?
W20170718-15:36:37.701(6)? (STDERR) /home/forhadmethun/.meteor/packages/meteor-tool/.1.5.1.dvn6c8++os.linux.x86_32+web.browser+web.cordova/mt-os.linux.x86_32/dev_bundle/server-lib/node_modules/fibers/future.js:313
W20170718-15:36:37.766(6)? (STDERR) throw(ex);
W20170718-15:36:37.767(6)? (STDERR) ^
W20170718-15:36:37.769(6)? (STDERR)
W20170718-15:36:37.769(6)? (STDERR) Error: Connection timeout
W20170718-15:36:37.770(6)? (STDERR) at Object.Future.wait (/home/forhadmethun/.meteor/packages/meteor-tool/.1.5.1.dvn6c8++os.linux.x86_32+web.browser+web.cordova/mt-os.linux.x86_32/dev_bundle/server-lib/node_modules/fibers/future.js:449:15)
W20170718-15:36:37.771(6)? (STDERR) at Mail._syncSendMail (packages/meteor.js:213:24)
W20170718-15:36:37.772(6)? (STDERR) at smtpSend (packages/email.js:116:13)
W20170718-15:36:37.773(6)? (STDERR) at Object.Email.send (packages/email.js:174:5)
W20170718-15:36:37.774(6)? (STDERR) at server/main.js:28:11
W20170718-15:36:37.775(6)? (STDERR) at Function.time (/home/forhadmethun/WebstormProjects/EmailSEndProject/.meteor/local/build/programs/server/profile.js:309:28)
W20170718-15:36:37.776(6)? (STDERR) at /home/forhadmethun/WebstormProjects/EmailSEndProject/.meteor/local/build/programs/server/boot.js:347:13
W20170718-15:36:37.777(6)? (STDERR) at /home/forhadmethun/WebstormProjects/EmailSEndProject/.meteor/local/build/programs/server/boot.js:388:5
W20170718-15:36:37.779(6)? (STDERR) at Function.run (/home/forhadmethun/WebstormProjects/EmailSEndProject/.meteor/local/build/programs/server/profile.js:510:12)
W20170718-15:36:37.780(6)? (STDERR) at /home/forhadmethun/WebstormProjects/EmailSEndProject/.meteor/local/build/programs/server/boot.js:386:11
W20170718-15:36:37.781(6)? (STDERR) - - - - -
W20170718-15:36:37.782(6)? (STDERR) at SMTPConnection._formatError (/home/forhadmethun/.meteor/packages/email/.1.2.3.3ikb16++os+web.browser+web.cordova/npm/node_modules/node4mailer/lib/smtp-connection/index.js:558:19)
W20170718-15:36:37.784(6)? (STDERR) at SMTPConnection._onError (/home/forhadmethun/.meteor/packages/email/.1.2.3.3ikb16++os+web.browser+web.cordova/npm/node_modules/node4mailer/lib/smtp-connection/index.js:531:20)
W20170718-15:36:37.785(6)? (STDERR) at [object Object].<anonymous> (/home/forhadmethun/.meteor/packages/email/.1.2.3.3ikb16++os+web.browser+web.cordova/npm/node_modules/node4mailer/lib/smtp-connection/index.js:249:18)
W20170718-15:36:37.787(6)? (STDERR) at Timer.listOnTimeout (timers.js:92:15)
Your MAIL_URL variable should look like
smtps://username%40gmail.com:password#smtp.gmail.com:465
If this won't help, you will need to allow the less secure applications and allow access to your account. This steps if done correctly should allow sending emails from Gmail. You can read more about Gmail security rules by looking at this answer.

Telescope app - "Exited with code : 8" error and app crashing

I'm new to meteor and playing with Telescope for past few days. Yesterday, I updated the Packages. From then on I'm not able to run the Telescope app in my Mac.
=> Started proxy.
=> Started MongoDB.
I20151128-19:27:24.429(8)? Kadira: completed instrumenting the app
W20151128-19:27:24.432(8)? (STDERR)
W20151128-19:27:24.432(8)? (STDERR) /Users/bala/.meteor/packages/meteor-tool/.1.1.10.jru118++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
W20151128-19:27:24.432(8)? (STDERR) throw(ex);
W20151128-19:27:24.433(8)? (STDERR) ^
W20151128-19:27:24.433(8)? (STDERR) Error: deny: Value for `update` must be a function
W20151128-19:27:24.433(8)? (STDERR) at packages/mongo/collection.js:755:1
W20151128-19:27:24.433(8)? (STDERR) at Array.forEach (packages/es5-shim/.npm/package/node_modules/es5-shim/es5-shim.js:417:1)
W20151128-19:27:24.433(8)? (STDERR) at Function._.each._.forEach (packages/underscore/underscore.js:105:1)
W20151128-19:27:24.433(8)? (STDERR) at [object Object].addValidator (packages/mongo/collection.js:752:1)
W20151128-19:27:24.433(8)? (STDERR) at [object Object].Mongo.Collection.deny (packages/mongo/collection.js:804:1)
W20151128-19:27:24.433(8)? (STDERR) at Posts.getNotificationProperties.properties.postAuthorName (lib/herald.js:7:21)
W20151128-19:27:24.433(8)? (STDERR) at /Users/bala/meteor/Telescope/.meteor/local/build/programs/server/boot.js:249:5
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.
Can anyone pls help me on this.
*Herald.js file is below
if (Meteor.absoluteUrl().indexOf('localhost') !== -1)
Herald.settings.queueTimer = 1000;
Meteor.startup(function () {
Herald.collection.deny({ update: !Users.can.editById, remove: !Users.can.editById });
// disable all email notifications when "emailNotifications" is set to false
Herald.settings.overrides.email = !Settings.get('emailNotifications', true); });
This is an issue with the recent Meteor 1.2 update. I would start by making sure you're using the latest version of all Telescope packages.
I have'd similar error with my meteor app, solved like this:
Close browser, exit terminal, reboot, open terminal, start app. It's something with browser.

What is the correct structure for using mocha to test your package?

Right now I have:
Package.describe({
name: 'parlay:synapsepay',
version: '0.0.1',
summary: 'synapse_pay_rest for Meteor',
git: 'https://github.com/parlaywithme/meteor-synapsepay',
documentation: 'README.md'
});
Package.onUse(function(api) {
api.versionsFrom('1.2.0.2');
api.use('coffeescript');
api.addFiles('synapsepay.coffee');
});
Package.onTest(function(api) {
api.use('coffeescript');
api.use('mike:mocha-package');
api.use('parlay:synapsepay');
api.addFiles('synapsepay-tests.coffee');
});
and
MochaWeb?.testOnly ->
describe 'sanity', ->
it 'is visible', ->
chai.assert.isDefined SynapsePay
https://github.com/parlaywithme/meteor-synapsepay
I'm getting a has no method 'testOnly' error, running
meteor test-packages ./
inside packages/meteor-synapsepay:
ERROR: packages.json parsing error [ ENOENT, no such file or directory '/Users/me/parlay/packages/meteor-synapsepay/packages.json' ]
[[[[[ Tests ]]]]]
=> Started proxy.
=> Started MongoDB.
W20151018-00:24:58.123(-4)? (STDERR)
W20151018-00:24:58.125(-4)? (STDERR) /Users/me/.meteor/packages/meteor-tool/.1.1.9.osr2yb++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
W20151018-00:24:58.125(-4)? (STDERR) throw(ex);
W20151018-00:24:58.125(-4)? (STDERR) ^
W20151018-00:24:58.125(-4)? (STDERR) TypeError: Object [object Object] has no method 'testOnly'
W20151018-00:24:58.125(-4)? (STDERR) at Package (packages/local-test_parlay_synapsepay/synapsepay-tests.coffee:1:11)
W20151018-00:24:58.125(-4)? (STDERR) at packages/local-test_parlay_synapsepay/synapsepay-tests.coffee:1:1
W20151018-00:24:58.126(-4)? (STDERR) at packages/local-test_parlay_synapsepay/synapsepay-tests.coffee:1:1
W20151018-00:24:58.126(-4)? (STDERR) at /private/tmp/meteor-test-run1tbmejw/.meteor/local/build/programs/server/boot.js:242:10
W20151018-00:24:58.126(-4)? (STDERR) at Array.forEach (native)
W20151018-00:24:58.126(-4)? (STDERR) at Function._.each._.forEach (/Users/me/.meteor/packages/meteor-tool/.1.1.9.osr2yb++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
W20151018-00:24:58.126(-4)? (STDERR) at /private/tmp/meteor-test-run1tbmejw/.meteor/local/build/programs/server/boot.js:137:5
=> Exited with code: 8
While poorly documented at the moment, this issue can be solved easily:
Simply ditch testOnly and write your tests directly in your test file.
describe 'sanity', ->
it 'is visible', ->
chai.assert.isDefined SynapsePay
Mocha was first designed for application tests. Using it for package tests can prove challenging.
When you will have your tests running, you may also see big Meteor.methods Match errors in the console. It is a common issue that should not interfere with the tests themselves.

Trying to run Meteor after updating to 0.9.4 on ubuntu getting errors like TypeError: Cannot call method 'add' of undefined

I am new-bee to meteor, i am struggling to run this.
kanna#kanna-VPCEB3QFX:~/Desktop/testhtml5/testhtml5/testHTML$ sudo meteor
[sudo] password for kanna:`enter code here`
[[[[[ ~/Desktop/testrschtml5/rschtml5/testHTML ]]]]]
=> Started proxy.
=> Started MongoDB.
W20141017-13:19:19.659(5.5)? (STDERR)
W20141017-13:19:19.737(5.5)? (STDERR) /home/kanna/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/dev_bundle/lib/node_modules/fibers/future.js:173
W20141017-13:19:19.738(5.5)? (STDERR) throw(ex);
W20141017-13:19:19.739(5.5)? (STDERR) ^
W20141017-13:19:19.739(5.5)? (STDERR) TypeError: Cannot call method 'add' of undefined
W20141017-13:19:19.739(5.5)? (STDERR) at app/server/route.js:8:15
W20141017-13:19:19.740(5.5)? (STDERR) at app/server/route.js:930:3
W20141017-13:19:19.740(5.5)? (STDERR) at /home/kanna/Desktop/testhtml5/testhtml5/testHTML/.meteor/local/build/programs/server/boot.js:168:10
W20141017-13:19:19.740(5.5)? (STDERR) at Array.forEach (native)
W20141017-13:19:19.741(5.5)? (STDERR) at Function..each..forEach (/home/kanna/.meteor/packages/meteor-tool/.1.0.34.1atmdl8++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
W20141017-13:19:19.741(5.5)? (STDERR) at /home/kanna/Desktop/rschtml5/rschtml5/testhtml5/.meteor/local/build/programs/server/boot.js:82:5
=> Exited with code: 8
The code for route.js is
Meteor.Router.add({
'/output/login': function () {
/some thing here
}

meteor 0.9.1 , Mongo is not defined inside my custom Package

Getting Exception Mongo is not defined inside my custom Package
CODE
ABC = new Mongo.Collection('ABC');
ERROR
W20140905-17:49:06.809(5.5)? (STDERR) /home/sandeep/.meteor/packages/meteor-tool/.1.0.27.18sl1cs++os.linux.x86_32+web.browser+web.cordova/meteor-tool-os.linux.x86_32/dev_bundle/lib/node_modules/fibers/future.js:173
W20140905-17:49:06.809(5.5)? (STDERR) throw(ex);
W20140905-17:49:06.810(5.5)? (STDERR) ^
W20140905-17:49:06.810(5.5)? (STDERR) ReferenceError: Mongo is not defined
You need to list all the packages you use in your package.js file:
Package.onUse(function (api) {
api.use('mongo', ['client', 'server']);
...
});
Also check that you have space on your HD, That was my problem.

Resources