0

I am trying to run PhantomJS on CentOS. I have used this page as a primer for installing it.

HOWEVER, when I go to run the version command, I get command not found.

I have verified that the file is 64bit and that I am running a 64it OS.

enter image description here

Any suggestions?

1
  • Yes: you showed us where your system searches for phantomjs, not where the executable is located. FFor phantomjs to work, it should be located in one of the directories specified by PATH, not in one of their subdirectories. Pls make sure that a copy of the executable is located in /usr/local/bin. Commented Aug 4, 2016 at 16:31

2 Answers 2

0

I guess your executable lacks x attribute. Make chmod +x phantomjs and try again.

0
  1. The instructions you pointed to refer to installation on Windows, but I assume you bent these to apply to a real CentOS installation.
  2. As @Dmitry_Teslenko suggests, ensure the file has executable-bit set.
  3. Call the file explicitly, since it does not appear to be in your path

    # from the directory where the phantomjs binary file exists on disk:
    ./phantomjs --version
    
  4. You can add the binary to the path in several ways:

    # link the file into a directory already in the path:
    sudo ln -l ./phantomjs /usr/local/bin
    # copy the file into a directory already in the path:
    sudo cp -p ./phantomjs /usr/local/bin
    # add the directory to the path:
    export PATH=$PATH:$PWD
    

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .