我在 centOS5 linux 服务器上运行它作为 CI 作业时遇到了同样的问题,使用 phantomJS 1.7(我自己编译的)
Running "jasmine" task
Testing jasmine specs via phantom
...
[D] ["phantomjs","onResourceReceived","GET
http://127.0.0.1:8888/test/spec/CommonTest.js"]
[D] ["phantomjs","onError","ReferenceError: Can't find variable: describe", [{"file":"http://127.0.0.1:8888/test/spec/CommonTest.js","line":31,"function":""}]]
ReferenceError: Can't find variable: describe
...
规范在其他机器如 WinXP 等上运行成功
最佳答案
最后,它是由以下原因引起的:我为“node_modules”创建了一个符号链接(symbolic link)以重新使用公共(public)模块,但它阻止了 grunt-jasmine-runner 获取某物。 (还不确定)。要解决它,需要将“node_modules”文件直接复制到项目文件夹下。
关于node.js - 通过 phantom 运行 jasmine specs,得到 "Can' t 找到变量 : describe",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13506393/