无法使用两行代码启动流星项目

时间:2015-04-06 19:53:00

标签: javascript meteor

我试图学习流星并通过流星提示,以及js文件中的第二行" PlayersList = new Mongo.Collection(' players');&#34 ;导致它无法运行。它说我在子​​目录中有一个重复的文件,但我不确定这是怎么可能的,因为我在那里只有三个文件是leaderboard.css,leaderboard.html和leaderboard.js。

我不确定如何格式化以使其更具可读性,感谢您的帮助!

这是日志:

C:\Users\jeffr_000\Documents\leaderboard>meteor
[[[[[ C:\Users\jeffr_000\Documents\leaderboard ]]]]]

=> Started proxy.
=> Started MongoDB.
=> Exited with code: 8
W20150406-12:20:14.063(-7)? (STDERR)
W20150406-12:20:14.065(-7)? (STDERR) C:\Users\jeffr_000\AppData\Local\.meteor\pa
ckages\meteor-tool\1.1.3\mt-os.windows.x86_32\dev_bundle\server-lib\node_modules
\fibers\future.js:245
W20150406-12:20:14.065(-7)? (STDERR)
throw(ex);
W20150406-12:20:14.066(-7)? (STDERR)
      ^
W20150406-12:20:14.066(-7)? (STDERR) Error: A method named '/member/insert' is a
lready defined
W20150406-12:20:14.066(-7)? (STDERR)     at packages/ddp/livedata_server.js:1461
:1
W20150406-12:20:14.066(-7)? (STDERR)     at Function._.each._.forEach (packages/
underscore/underscore.js:113:1)
W20150406-12:20:14.066(-7)? (STDERR)     at [object Object]._.extend.methods (pa
ckages/ddp/livedata_server.js:1459:1)
W20150406-12:20:14.067(-7)? (STDERR)     at [object Object].Mongo.Collection._de
fineMutationMethods (packages/mongo/collection.js:904:1)
W20150406-12:20:14.067(-7)? (STDERR)     at new Mongo.Collection (packages/mongo
/collection.js:209:1)
W20150406-12:20:14.067(-7)? (STDERR)     at app\leaderboard.js:3:14
W20150406-12:20:14.067(-7)? (STDERR)     at app\leaderboard.js:5:3
W20150406-12:20:14.068(-7)? (STDERR)     at C:\Users\jeffr_000\Documents\leaderb
oard\.meteor\local\build\programs\server\boot.js:222:10
W20150406-12:20:14.068(-7)? (STDERR)     at Array.forEach (native)
W20150406-12:20:14.068(-7)? (STDERR)     at Function._.each._.forEach (C:\Users\
jeffr_000\AppData\Local\.meteor\packages\meteor-tool\1.1.3\mt-os.windows.x86_32\
dev_bundle\server-lib\node_modules\underscore\underscore.js:79:11)
W20150406-12:20:20.151(-7)? (STDERR)
W20150406-12:20:20.151(-7)? (STDERR) C:\Users\jeffr_000\AppData\Local\.meteor\pa
ckages\meteor-tool\1.1.3\mt-os.windows.x86_32\dev_bundle\server-lib\node_modules
\fibers\future.js:245
W20150406-12:20:20.152(-7)? (STDERR)
throw(ex);
W20150406-12:20:20.152(-7)? (STDERR)
      ^
W20150406-12:20:20.152(-7)? (STDERR) Error: A method named '/member/insert' is a
lready defined
W20150406-12:20:20.152(-7)? (STDERR)     at packages/ddp/livedata_server.js:1461
:1
W20150406-12:20:20.153(-7)? (STDERR)     at Function._.each._.forEach (packages/
underscore/underscore.js:113:1)
W20150406-12:20:20.153(-7)? (STDERR)     at [object Object]._.extend.methods (pa
ckages/ddp/livedata_server.js:1459:1)
W20150406-12:20:20.153(-7)? (STDERR)     at [object Object].Mongo.Collection._de
fineMutationMethods (packages/mongo/collection.js:904:1)
W20150406-12:20:20.154(-7)? (STDERR)     at new Mongo.Collection (packages/mongo
/collection.js:209:1)
W20150406-12:20:20.154(-7)? (STDERR)     at app\leaderboard.js:3:14
W20150406-12:20:20.154(-7)? (STDERR)     at app\leaderboard.js:5:3
W20150406-12:20:20.155(-7)? (STDERR)     at C:\Users\jeffr_000\Documents\leaderb
oard\.meteor\local\build\programs\server\boot.js:222:10
W20150406-12:20:20.155(-7)? (STDERR)     at Array.forEach (native)
W20150406-12:20:20.155(-7)? (STDERR)     at Function._.each._.forEach (C:\Users\
jeffr_000\AppData\Local\.meteor\packages\meteor-tool\1.1.3\mt-os.windows.x86_32\
dev_bundle\server-lib\node_modules\underscore\underscore.js:79:11)
=> Exited with code: 8
W20150406-12:20:26.038(-7)? (STDERR)
W20150406-12:20:26.038(-7)? (STDERR) C:\Users\jeffr_000\AppData\Local\.meteor\pa
ckages\meteor-tool\1.1.3\mt-os.windows.x86_32\dev_bundle\server-lib\node_modules
\fibers\future.js:245
W20150406-12:20:26.038(-7)? (STDERR)
throw(ex);
W20150406-12:20:26.038(-7)? (STDERR)
      ^
W20150406-12:20:26.038(-7)? (STDERR) Error: A method named '/member/insert' is a
lready defined
W20150406-12:20:26.039(-7)? (STDERR)     at packages/ddp/livedata_server.js:1461
:1
W20150406-12:20:26.039(-7)? (STDERR)     at Function._.each._.forEach (packages/
underscore/underscore.js:113:1)
W20150406-12:20:26.039(-7)? (STDERR)     at [object Object]._.extend.methods (pa
ckages/ddp/livedata_server.js:1459:1)
W20150406-12:20:26.040(-7)? (STDERR)     at [object Object].Mongo.Collection._de
fineMutationMethods (packages/mongo/collection.js:904:1)
W20150406-12:20:26.040(-7)? (STDERR)     at new Mongo.Collection (packages/mongo
/collection.js:209:1)
W20150406-12:20:26.040(-7)? (STDERR)     at app\leaderboard.js:3:14
W20150406-12:20:26.041(-7)? (STDERR)     at app\leaderboard.js:5:3
W20150406-12:20:26.041(-7)? (STDERR)     at C:\Users\jeffr_000\Documents\leaderb
oard\.meteor\local\build\programs\server\boot.js:222:10
W20150406-12:20:26.041(-7)? (STDERR)     at Array.forEach (native)
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.
W20150406-12:20:26.042(-7)? (STDERR)     at Function._.each._.forEach (C:\Users\
jeffr_000\AppData\Local\.meteor\packages\meteor-tool\1.1.3\mt-os.windows.x86_32\
dev_bundle\server-lib\node_modules\underscore\underscore.js:79:11)

1 个答案:

答案 0 :(得分:2)

通常,当您遇到A method named '/member/insert' is a lready defined之类的错误时,就意味着您创建的new Mongo.Collection('member')次数超过了一次。

也许您是在Array.forEach函数中执行此操作(如果您的数组包含多个元素,则会多次调用)。

从错误日志中看,它似乎是由fn _.each(array,fn) server\boot.js引起的。{/ p>