CNode

phantomjs-node 示例出问题

Ffyddaben发布于13 年前最后回复11 年前6 回复13080 浏览0 收藏
**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)

F
fyddaben#1·13 年前
 顶起来啊。。。我只是想用nodejs调用下phantomjs,用子进程调用,还是上面的那个错误。。。。
H
hankwang#2·13 年前

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();
F
fyddaben#3·13 年前
引用 hankwangTry this

把上面代码保存为test.js ,然后node test.js 结果相同。。还是错误, stderr: execvp(): Too many levels of symbolic links

H
hankwang#4·13 年前
引用 hankwangTry this

@fyddaben 感覺是你的exec PATH有問題

參考一下這篇:

http://stackoverflow.com/questions/7027740/makefile-and-symbolic-links

J
jintaolee#5·11 年前

windows 平台也出现同样的错误,怎么解决啊!

Y
yakczh#6·11 年前

把phantomjs-2.0.0-windows\bin 加到PATH路径了,然后运行 casperjs test.js 结果提示  CasperJS needs PhantomJS v1.x

参与回复
登录后即可参与回复。登录