To install Phonegap on Ubuntu (mine is 14.04) you would need node.js/npm.
So first let’s go ahead and install the latest node.js –
1 2 |
$ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - $ sudo apt-get install -y nodejs |
Note: Doing –
1 |
sudo apt-get install nodejs |
installs quite an old version of node.js.
So next to install Phonegap just run –
1 |
$ npm install -g phonegap |
For 64-bit systems, install the 32-bit dependencies:
1 2 |
$ sudo apt-get install lib32stdc++6 $ sudo apt-get install lib32z1 |
To check do a
1 |
phonegap -v |
and you will get the version number of Phonegap installed in your system.
Now that we have our installation in place. Let’s create an app and run that. Go to the directory where you want to create the app and run the following command –
1 2 |
$ phonegap create my-app Creating a new cordova project. |
Now cd to my-app directory and start the Phonegap server
1 2 3 4 5 6 |
$ phonegap serve [phonegap] starting app server... [phonegap] listening on 10.0.0.3:3000 [phonegap] [phonegap] ctrl-c to stop the server [phonegap] |
You might get a different ip for your machine. But the server has started.
You can check my-app using the browser (you might get some errors in the console, as it won’t find the cordova.js). This is what you should see –
But better still you can install the Phonegap app on your phone and check it there.
Congratulations, you have created your first Phonegap mobile app.
Nandini is a Web Developer and a blogger who loves tinkering with new technologies, frameworks and devices. When not in front of her computer she likes to travel, read and spend time gardening.