【发布时间】:2014-01-05 22:23:53
【问题描述】:
我想在客户端和服务器端都使用Box2D-Web 和Meteorjs。我在nodejs 中使用了这个。有一个导出Box2D 变量的小配置,它正在使用nodejs。附加配置是
exports.Box2D = Box2D;
在库的底部。
但我无法将其加载到 meteor。我将Box2D-web 放在我的项目中的lib 目录下。但它给出了一个错误,我仍然不明白问题是什么。
这是流星所说的;
W20140106-00:15:03.627(2)? (STDERR) /Users/ahmetdal/workspace/realhaxtmp/.meteor/local/build/programs/server/boot.js:186
W20140106-00:15:03.692(2)? (STDERR) }).run();
W20140106-00:15:03.692(2)? (STDERR) ^
W20140106-00:15:03.692(2)? (STDERR) TypeError: Cannot call method 'write' of undefined
W20140106-00:15:03.693(2)? (STDERR) at Console.log (console.js:53:16)
W20140106-00:15:03.694(2)? (STDERR) at Object.Meteor._debug (packages/meteor/debug.js:41)
W20140106-00:15:03.694(2)? (STDERR) at _.extend.publish (packages/livedata/livedata_server.js:1166)
W20140106-00:15:03.694(2)? (STDERR) at app/server/publications.js:7:12
W20140106-00:15:03.694(2)? (STDERR) at /Users/ahmetdal/workspace/realhaxtmp/.meteor/local/build/programs/server/boot.js:159:61
W20140106-00:15:03.694(2)? (STDERR) at Array.forEach (native)
W20140106-00:15:03.694(2)? (STDERR) at Function._.each._.forEach (/Users/ahmetdal/.meteor/tools/09b63f1ed5/lib/node_modules/underscore/underscore.js:79:11)
W20140106-00:15:03.695(2)? (STDERR) at /Users/ahmetdal/workspace/realhaxtmp/.meteor/local/build/programs/server/boot.js:159:5
Box2D-Web 库没有错误。我试图找到错误的任何替代含义,但我也找不到任何东西。
当我将库放在项目根目录下的lib 文件夹下时发生此错误。
我没有把库的所有代码都放在这里。因为它确实包含太多的代码行。
我可以在库中做哪些额外的配置来将其应用于Meteorjs?
谢谢!
【问题讨论】:
-
我一添加 box2d,Meteor 就崩溃了。通过查看他们的代码,我的猜测是,由于他们向全局变量声明了很多,如果其中一个全局变量被命名为流星之一,那么他们只会使整个事情崩溃。
-
Box2d-Web 有哪些好的参考资料?