Tuesday, April 15, 2014

phantomjs: error while loading shared libraries: libfreetype.so.6: cannot open shared object file: No such file or directory

CentOS - If you are getting this error while executing phantomjs on terminal

phantomjs: error while loading shared libraries: libfreetype.so.6: cannot open shared object file: No such file or directory
 
To remove this error.

# sudo yum install freetype
If you are still facing the error, Run
# sudo yum install fontconfig freetype libfreetype.so.6 libfontconfig.so.1 libstdc++.so.6
Note :
If you are using ubuntu or debian, use apt-get install to install this package.

Install phantomjs on Linux

Install phantomjs on Ubuntu / Debian

Download phantomjs package from here

If you have 32 bit Linux distribution, download 32 bit file package or if you are using 64 bit Linux distribution, download the 64 bit package.

Extract the zip file and open the directory. Now you will find the phantomjs file inside bin directory.

Copy the file and paste into /usr/bin, /usr/local/bin & /usr/local/share.

Create a file hello.js and put following code into it.


console.log('Hello, world!');
phantom.exit();
Now run the phantomjs from the terminal.
# phantomjs /path/of/hello.js or # /usr/bin/phantomjs /path/of/hello.js

Install phantomjs on CentOS / RHEL

Download phantomjs package from here

If you have 32 bit Linux distribution, download 32 bit file package or if you are using 64 bit Linux distribution, download the 64 bit package.

Extract the zip file and open the directory. Now you will find the phantomjs file inside bin directory.

Copy the file and paste into /usr/bin, /usr/local/bin & /usr/local/share.

Create a file hello.js and put following code into it.
console.log('Hello, world!'); phantom.exit();
Now run the phantomjs from the terminal.
# phantomjs /path/of/hello.js or # /usr/bin/phantomjs /path/of/hello.js
If you get the error
phantomjs: error while loading shared libraries: libfreetype.so.6: cannot open shared object file: No such file or directory

 
To remove this error.

# sudo yum install freetype

Now run hello.js again but if you get another error
phantomjs: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory

 
To remove this error.

# sudo yum install fontconfig
 If you are still facing the error, Run
# sudo yum install fontconfig freetype libfreetype.so.6 libfontconfig.so.1 libstdc++.so.6
Now run again, it should work.

# phantomjs hello.js Hello, world!
Note : 
Execute or Run phantomjs on browser
you can't directly reference a phantomjs script in your browser, but you can communicate with a PhantomJS instance using HTTP GET/POST with Web Server module

Monday, April 14, 2014

ERROR:dbus.proxies:Introspect error on :1.303:/org/freedesktop/PackageKit: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken

Open file /etc/dbus-1/system.d/org.freedesktop.PackageKit.conf
Find the line
<allow send_interface=org.freedesktop.PackageKit"/>
Add following line after above line
<allow send_interface="org.freedesktop.PackageKit.Transaction"/>

Open file /etc/dbus-1/system.conf
Find both lines
<allow send_requested_reply="true" send_type="method_return"/>
<allow send_requested_reply="true" send_type="error"/>

and replace top line with following line
<allow send_requested_reply="true"/>
Now delete the bottom line.