phantomjs-node 示例出问题
**phantom stderr: execvp(): Too many levels of symbolic links**
var phantom=require('phantom');
exports.testPhantomCreatePage=function(beforeExit,assert) {
phantom.create(function(err,ph) {
ph.createPage(function(page){
page.open("http://www.google.com",function(status){
console.log("opened google? ",status);
});
var result=page.evaluate(function(){
return document.title;
});
console.log(result);
});
ph.exit();
});
};
有木有出现这种情况的???后台只有上面的一句话
6 回复
顶起来啊。。。我只是想用nodejs调用下phantomjs,用子进程调用,还是上面的那个错误。。。。
Try this
var phantom = require('phantom');
var testPhantomCreatePage = exports.testPhantomCreatePage = function(beforeExit, assert) {
phantom.create(function(ph) {
ph.createPage(function(page){
page.open("http://www.google.com",function(status) {
console.log("opened google? ",status);
page.evaluate((function(){
return document.title;
}), function(result) {
console.log(result);
ph.exit();
});
});
});
});
};
testPhantomCreatePage();
把上面代码保存为test.js ,然后node test.js 结果相同。。还是错误, stderr: execvp(): Too many levels of symbolic links
@fyddaben 感覺是你的exec PATH有問題
參考一下這篇:
http://stackoverflow.com/questions/7027740/makefile-and-symbolic-links
windows 平台也出现同样的错误,怎么解决啊!
把phantomjs-2.0.0-windows\bin 加到PATH路径了,然后运行 casperjs test.js 结果提示 CasperJS needs PhantomJS v1.x