I just started experimenting with phantomjs via terminal/bash Version 2.5.3 (343.7), on osx 10.10.4. The ready to use binary was installed.
I was able to set phantomjs on my PATH with symbolical linking. Prior to that I had to directly launch the executable or enter its absolute path.
When I try to launch a .js file with phantomjs, for example hello.js, I get " Can't open 'hello.js' ". If I enter the absolute path of the .js file it works:
console.log('Hello, world! It works :D');
phantom.exit();
Johns-MacBook-Pro:~ john$ phantomjs hello.js
Can't open 'hello.js'
VS
console.log('Hello, world! It works :D');
phantom.exit();
Johns-MacBook-Pro:~ john$ phantomjs /Users/john/Documents/phantomjs-1.9.2-macosx/examples/hello.js
Hello, world! It works :D
Johns-MacBook-Pro:~ john$
My question is: Do I need to symbolically link the folder where the .js files are located with /usr/local/bin/ to ensure that it is also on my PATH or is there another way that the .js files can be launched with phantomjs, without having to enter the absolute path every time?
I did search before posting this question but I'm uncertain as to how I should interpret everything I found :( The most significant, and somewhat relevant information I found referenced to node.js as the default to execute .js files in terminal.
Please note that currently, the hello.js file I am using is located in
/Users/john/Documents/phantomjs-1.9.2-macosx/examples/hello.js
and phantomjs is located in
/Users/john/Documents/phantomjs-1.9.2-macosx/bin/phantomjs
Please let me know if you need further information and thank you for taking the time to read my question! :)