在将Meteor版本从1.2升级到1.3之后,我得到了以下错误:
=> Started proxy.
=> Started MongoDB.
W20160130-14:27:48.841(3)? (STDERR)
W20160130-14:27:48.841(3)? (STDERR) C:\Users\Vladimir\AppData\Local\.meteor\pack
ages\meteor-tool\1.1.12-modules.5\mt-os.windows.x86_32\dev_bundle\server-lib\nod
e_modules\fibers\future.js:245
W20160130-14:27:48.841(3)? (STDERR)
throw(ex);
W20160130-14:27:48.841(3)? (STDERR)
^
W20160130-14:27:48.841(3)? (STDERR) ReferenceError: Games is not defined
W20160130-14:27:48.841(3)? (STDERR) at meteorInstall.lib.collections.js (lib
/collections.js:1:1)
W20160130-14:27:48.841(3)? (STDERR) at fileEvaluate (packages/modules-runtim
e/.npm/package/node_modules/install/install.js:183:1)
W20160130-14:27:48.841(3)? (STDERR) at require (packages/modules-runtime/.np
m/package/node_modules/install/install.js:75:1)
W20160130-14:27:48.841(3)? (STDERR) at C:\code\steambot\.meteor\local\build\
programs\server\app\app.js:404:1
W20160130-14:27:48.841(3)? (STDERR) at C:\code\steambot\.meteor\local\build\
programs\server\boot.js:242:10
W20160130-14:27:48.841(3)? (STDERR) at Array.forEach (native)
W20160130-14:27:48.841(3)? (STDERR) at Function._.each._.forEach (C:\Users\V
ladimir\AppData\Local\.meteor\packages\meteor-tool\1.1.12-modules.5\mt-os.window
s.x86_32\dev_bundle\server-lib\node_modules\underscore\underscore.js:79:11)
W20160130-14:27:48.841(3)? (STDERR) at C:\code\steambot\.meteor\local\build\
programs\server\boot.js:137:5
=> Exited with code: 8我的档案结构:
-.meteor
-client
-server
-public
-lib (collections.js here)collections.js:
Games = new Mongo.Collection('games');在升级到1.3之前,一切都很好。
发布于 2016-01-30 11:48:15
而不是
Games = new Mongo.Collection('games');做
global.Games = new Mongo.Collection('games');因为
在beta 5中,全球都有问题。
更多信息:https://github.com/meteor/meteor/issues/5788#issuecomment-175927524
发布于 2016-05-13 17:44:17
在Meteor1.3中,推荐的方法是使用import,而不是将所有东西都迁移到全局。
// collections.js
export const Games = new Mongo.Collection('games');然后
// any_other_file.js
import { Games } from '../lib/collections'https://stackoverflow.com/questions/35101258
复制相似问题