ReferenceError:窗口没有定义
我试图通过Wooga运行Pocket-Island游戏,并安装了该页面列出的所有先决条件:
gem install rake npm install -g less npm install -g jslint ...
然后通过运行成功构build程序
rake all
现在有一个新的build
目录:
app.js css images index.html ipad.html templates version
app.js是400k,看起来像一个最小化的JavaScript文件。
然后我尝试运行它与node
:
#node ./app.js /home/afarber/src/Pocket-Island/build/app.js:1 window.wooga.cas ^ ReferenceError: window is not defined at Object.<anonymous> (/home/afarber/src/Pocket-Island/build/app.js:1:63) at Module._compile (module.js:446:26) at Object..js (module.js:464:10) at Module.load (module.js:353:31) at Function._load (module.js:311:12) at Array.0 (module.js:484:10) at EventEmitter._tickCallback (node.js:190:38)
作为一个完整的node.js新手,我怀疑我失去了一些非常明显的东西。 有人请给我一个build议吗?
我已经看了app.js,没有window.wooga.cas
,但有以下几个variables:
window.wooga.castle.levels = ..... window.wooga.castle.entityDefinitions = ..... window.wooga.castle.version = "38da43a566503f3043576dafaf77f89363017397" ; window.wooga.castle.tutorial = ....
所以我认为app.js
是可以的,但是我必须把它安装在某个地方,或者告诉它在哪里可以find标准库? (我在/usr/local/
下安装了node.js )
我使用的是CentOS 6.2,实际上我是一个有经验的Linux用户。
更新:更多信息(不知道如果有帮助):
# npm root /home/afarber/src/Pocket-Island/build/node_modules # npm --version 1.1.24 # node --version v0.6.19
节点仅用于构build,而不用于运行游戏。 它看起来像构build本身运行良好。 app.js
是由web浏览器中的index.html
加载的。