Meteor 0.9.1:ReferenceError:未定义SimpleSchema

时间:2014-09-06 17:55:26

标签: meteor

在决定创建一个新项目并重新开始然后签出一个单独项目的代码(处于工作状态)后,我遇到了简单模式的以下错误。这个架构正在运行,因此在某些方面更新可能会破坏它。

有人可以建议我需要做些什么来排序吗?

终端输出:

$ 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

架构:

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);

2 个答案:

答案 0 :(得分:0)

修正了它,最终不得不创建一个新的Meteor应用程序。 https://github.com/aldeed/meteor-simple-schema/issues/147

答案 1 :(得分:0)

我有同样的问题。通过以下步骤解决 - 安装SimpleSchema: