Install Node-Webkit On Ubuntu Linux
Install node-webkit on Ubuntu Linux
Akbar S. Ahmed | Mar 20, 2014

Step-by-step instructions

Installing node-webkit on Ubuntu Linux is easy. We are going to install node-webkit into our home directory so that we do not need to use sudo during development.

If you use Ubuntu 13.04 or 13.10 there is a fix for the libudev error at the end of this post.

Create a directory structure to store locally installed packages.

mkdir -p ~/opt/packages && cd $_

Change the version numbers below as new versions of node-webkit are released.

Download the node.js package.

wget https://s3.amazonaws.com/node-webkit/v0.9.1/node-webkit-v0.9.1-linux-x64.tar.gz

Unzip the package.

gzip -dc node-webkit-v0.9.1-linux-x64.tar.gz | tar xf -

Create a symlink to the currently installed version. We can change the symlink in the future to easily upgrade our node-webkit version.

ln -s ~/opt/packages/node-webkit-v0.9.1-linux-x64/ ~/opt/node-webkit

Add node-webkit to your PATH.

vi ~/.profile

Write the following in your .profile file:

# Add node-webkit to PATH
if [ -d "$HOME/opt/node-webkit" ]; then
    PATH="$PATH:$HOME/opt/node-webkit"
fi

Source your .profile file.

source ~/.profile

Ensure that the nw command is in your PATH.

which nw

Fix the libudev.so.0 error on Ubuntu 13.04 / 13.10

If you are using Ubuntu 13.04 or 13.10, then you will get the following error when you first run nw.

error while loading shared libraries: libudev.so.0: cannot open shared object
file: No such file or directory

The problem is that newer versions of Ubuntu use libudev.so.1 while node-webkit is built against libudev.so.0. However, fixing the error is easy.

sudo apt-get install ghex

cd ~/opt/node-webkit

ghex nw

The ghex GUI will open with nw loaded.

  • Expand the window as this makes editing easier.
  • Press Ctrl + F to open the Find dialog box.
  • Press Tab to move the cursor to the right textbox.
  • Type libudev.so.
  • Click Find Next.
  • You should now see libudev.so.0. libudev.so will be highlighted in red. Resize the window if you do not see every character in libudev.so.0.
  • Select 0 with your mouse and type 1.
  • Select File, click Save.
  • Select File, click Exit.

Run nw and you should see an empty node-webkit window.




Subscribe to our newsletter

Contact Information

ABOUT EXPONENTIAL.IO

We specialize in helping professional developers, like you, expand your skill set. Our courses are focused on enabling you to learn everything necessary to use a new technology in a live, production application.

LOCATION

All courses are made with love in
Palo Alto, CA.

Subscribe to our newsletter