Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't install phantomjs on server

Tags:

phantomjs

I'm having a difficult time getting phantomjs installed on my server. I haven't found very good directions anywhere and the best I've found give me errors when I try to complete them. As of now I'm following these steps and getting these errors.

Successfully used putty to login as root and run the following commands

Line 1: yum install fontconfig freetype freetype-devel fontconfig-devel libstdc++
No errors


Line 2: wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2
No errors

Line 3: mkdir -p /opt/phantomjs
No errors

Line 4: tar -xjvf ~/phantomjs-1.9.8-linux-x86_64.tar.bz2 --strip-components 1 /opt/phantomjs/
Error: opt/phantomjs: Not found in archive

For this error (line 4) I ftp into my server and didn't see any directory for opt/phantomjs. I created one but am having the same "Not found in archive" error.

After this the only other lines of code, from what I've found, should be:

Line 5: ln -s /opt/phantomjs/bin/phantomjs /usr/bin/phantomjs
Line 6: phantomjs /opt/phantomjs/examples/hello.js

If anyone has any insight I'd greatly appreciate it!

like image 319
Buster Avatar asked Jun 11 '15 18:06

Buster


People also ask

How do I use phantomjs EXE?

Go to the “bin” folder and check phantomjs.exe file. If you are using it on a Windows OS, then you can set the path variable under the environment variable for fast access through command prompt. The command to run the PhantomJS program: C:\> phantomjs [options] file.

How do I upgrade phantomjs?

//use this if you installed with apt-get sudo apt-get remove phantomjs *remove the phantomjs rm /usr/bin/phantomjs *use this if the link didn't remove. //use this if you installed from npm: like this: npm install phantomjs rm -R /node_modules/phantomjs *note: it will be in other folder, search it.


1 Answers

Well after a lot of trial and error it seems to be working (so far). The problem was the syntax of line 4. This solved the issue and line 5 and 6 worked fine.

UPDATED LINE 4: tar -xjvf ~/phantomjs-1.9.8-linux-x86_64.tar.bz2 --strip-components=1 -C /opt/phantomjs/

Hopefully this helps someone else having the same issue.

Anyone know of a good tutorial on using it for highcharts in php?

like image 158
Buster Avatar answered Jan 04 '23 01:01

Buster