Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/395.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 类型错误:';未定义';不是对象(正在评估';requireDirs.forEach';)_Javascript_Phantomjs_Casperjs - Fatal编程技术网

Javascript 类型错误:';未定义';不是对象(正在评估';requireDirs.forEach';)

Javascript 类型错误:';未定义';不是对象(正在评估';requireDirs.forEach';),javascript,phantomjs,casperjs,Javascript,Phantomjs,Casperjs,所以,我今天将代码从windows转换到linux,以确保一切正常。我设法打破了casper/phantom,但我甚至不知道如何打破 下面是我在linux(ubuntu 12.14)上运行casper脚本的命令: 它给了我这个: TypeError: 'undefined' is not an object (evaluating 'requireDirs.forEach') in module (./get_all_urls:102) /var/www/tekalyze/phantom/get

所以,我今天将代码从windows转换到linux,以确保一切正常。我设法打破了casper/phantom,但我甚至不知道如何打破

下面是我在linux(ubuntu 12.14)上运行casper脚本的命令:

它给了我这个:

TypeError: 'undefined' is not an object (evaluating 'requireDirs.forEach')
in module (./get_all_urls:102)
/var/www/tekalyze/phantom/get_all_urls.js:102 in _require
/var/www/tekalyze/phantom:13 in anonymous
/home/casper/casperjs/bin/bootstrap.js:146 in _require
/var/www/tekalyze/phantom/get_site_info.js:8
/var/www/tekalyze/phantom/get_site_info.js:228
get_all_URL的第102行是:

crawl.call(this, links[currentLink]);
我试着对它进行注释,堆栈跟踪保持不变,这让我相信它没有关系

可以找到相关文件

老实说,我只是在挠头。我查看了bootstrap.js:146,看到了一些关于phantom.casperPath的内容,但我不必在windows中设置环境变量,所以我不确定linux是否需要这样做。问题是:
if(!phantom.casperPath)
——这让我相信,如果我先从phantom开始重新编写所有内容,然后设置所有casper变量,我就可以实现这一点,但我还没有验证这是否可行


另外,我使用脚本安装了它们,因此应该正确设置目录。

事实证明,直到1.1.0-DEV才添加此功能,因此在linux上更新此功能而不是使用1.0.0是最好的解决方案

crawl.call(this, links[currentLink]);