Phantom js returns 'can't open [file name]' when trying to run example js file

倾然丶 夕夏残阳落幕 提交于 2019-12-10 13:29:13

问题


Environment: Windows 7, Phantomjs version 1.8.0.

I try to run any .js file from 'examples' folder, installed Phantom.js before, added path to the PATH variable, checked version like

phantomjs --version

and it works.

But when I try to run

phantomjs examples/version.js

then get 'Can't open version.js'

I've checked file security settings and run cmd like administrator, but still the same result.

I'll appreciate any help to solve this issue. Thanks in advance.


回答1:


Was having the same trouble. Finally solved it by specifying absolute path to phatnomjs executable.

instead of:

phantomjs myjsfile.js

do:

/my/absolute/path/to/phantomjs/phantomjs myjsfile.js

I suspect setting up PATH to it will have the same effect, have not tested it though.




回答2:


In my case,

/mypath/phantomjs /mypath/myfile.js

It takes three days for finding this out. Pretty wired syntax to me.

If it doesn't work then use . in front of first /

    ./mypath/phantomjs ./mypath/myfile.js

. means base dir as you set in the R studio



来源:https://stackoverflow.com/questions/14041406/phantom-js-returns-cant-open-file-name-when-trying-to-run-example-js-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!