How to Install Apache Cordova on Ubuntu 18.04 LTS

Apache Cordova

How to Install Apache Cordova on Ubuntu 18.04 LTS

Apache Cordova (Formerly known as PhoneGap) is a free and an open source mobile development framework that can be used to build applications for mobile devices using CSS3, HTML5, and JavaScript. You can build hybrid mobile applications using HTML, CSS, and JavaScript in Cordova platform that will be used on different mobile platforms like, IOS, Android, Windows. Cordova is faster to develop hybrid app then native app, so it can save your development time.

In this tutorial, we will learn how to install Cordova on Ubuntu 18.04 LTS (Bionic Beaver).


  • A server running Ubuntu 18.04 to your system.
  • A non-root user with sudo privileges.

Install Node.js

First, you will need to install the latest version of Node.js to your system. By default, the latest version of Node.js is not available in Ubuntu 18.04 default repository. So, you will need to add PPA for node.js to your system.

You can do this with the following command:sudo apt-get install python-software-properties -y
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -

Once the repository is installed, install Node.js using the following command:sudo apt-get install nodejs -y

Install Cordova

Now, install Cordova using the npm command as below:sudo npm install -g cordova

Output:/usr/bin/cordova -> /usr/lib/node_modules/cordova/bin/cordova
+ [email protected]
updated 1 package in 15.829s

Once the Cordova is installed, you can check the version using the following command:cordova --version

Output:? May Cordova anonymously report usage statistics to improve the tool over time? Yes

Thanks for opting into telemetry to help us improve cordova.


Create Your First App

Cordova is now installed, it’s time to create an app using Cordova.

Run the following command to create your first app with name TestApp:cordova create TestApp

Output:Creating a new cordova project.

Next, change the directory to the TestApp and add the required platform in your application.cd TestApp
cordova platform add android

You should see the following output:Using cordova-fetch for cordova-android@~7.0.0
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms/android
Package: io.cordova.hellocordova
Name: HelloCordova
Activity: MainActivity
Android target: android-26
Subproject Path: CordovaLib
Subproject Path: app
Android project created with [email protected]
Android Studio project detected
Android Studio project detected
Discovered plugin "cordova-plugin-whitelist" in config.xml. Adding it to the project
Installing "cordova-plugin-whitelist" for android

This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.

Adding cordova-plugin-whitelist to package.json
Saved plugin info for “cordova-plugin-whitelist” to config.xml
–save flag or autosave detected
Saving android@~7.0.0 into config.xml file …

Next, run the following command to list the installed and available platforms for Cordova application.cordova platform -ls

Output:Installed platforms:
android 7.0.0
Available platforms:
browser ~5.0.1
ios ~4.5.4
osx ~4.0.1
windows ~5.0.0
www ^3.12.0

If you want to remove any platform, you can remove it by just running the following command:cordova platform remove android

Next, you will need to fulfill all the requirements for your build environment. You can do this by running the following command:cordova requirements

Once all the required dependencies are installed successfully, run the following command to build your application:cordova build android

Đăng ký liền tay Nhận Ngay Bài Mới

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !

Add Comment

Click here to post a comment

Đăng ký liền tay
Nhận Ngay Bài Mới

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !