Home  >  Q&A  >  body text

centos - 安装phantomjs后输入phantomjs --v提示:-bash:phantomjs:command not found

centos,按照网上的教程:

sudo yum install gcc gcc-c++ make git openssl-devel freetype-devel fontconfig-devel 
git clone git://github.com/ariya/phantomjs.git 
cd phantomjs 
git checkout 1.9 
./build.sh  

安装了一个多小时完成后输入phantomjs --v,显示-bash:phantomjs:command not found,请问该怎么办?

世界只因有你世界只因有你2733 days ago820

reply all(5)I'll reply

  • 滿天的星座

    滿天的星座2017-04-25 09:03:29

    It is estimated that phantomjs did not add its executable path to PATH.

    # vim /etc/profile
    

    At the end, add:

    export PATH="$PATH:/yourpath"
    

    reply
    0
  • 怪我咯

    怪我咯2017-04-25 09:03:29

    Try the method on the first floor. Ok, if it doesn’t work, add the following sentence. It seems that I have encountered it before

    export PHANTOMJS_EXECUTABLE=/usr/local/bin/phantomjs
    

    Replace /usr/local/bin/phantomjs with the binary file path after your own installation.

    reply
    0
  • PHPz

    PHPz2017-04-25 09:03:29

    I encountered the same problem. How did I solve it?

    reply
    0
  • PHP中文网

    PHP中文网2017-04-25 09:03:29

    ln -s /usr/local/src/phantomjs/bin/phantomjs /usr/local/bin/
    /usr/local/src/phantomjs/bin/phantomjs is your installation path

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-25 09:03:29

    Copy root/phantomjs/bin/phantomjs to system/bin and it’s done

    reply
    0
  • Cancelreply