问题
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