Join egghead, unlock knowledge.

Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson
1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Install the Ionic 4 CLI

    Chris GriffithChris Griffith
    ionicIonic

    Learn how to install the Ionic 4 CLI and validate its installation.

    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Discuss

    Discuss

    Transcript

    Transcript

    Instructor: To get started with Ionic, we first need to install node.js and NPM as these are required to use the Ionic CLI. If you don't already have node installed in your computer, you can download it from the node.js website.

    Once you have it installed, verify the version of node by executing node -v in your terminal or command line. We should also verify the version of NPM as well by executing NPM -v. Now let's install the Ionic CLI by running NPM install -g ionic.

    For Linux and Mac users, you may want to prepend sudo to that command for it to install properly. For Windows users, make sure you're installing them from an admin account. Once complete, you'll also want to install a Cordova CLI as well by running NPM install -g cordova. Odds are you'll be publishing your Ionic application as a Cordova-based native mobile application.

    With our installations complete, we can create our first Ionic project. From the command line, I will run ionic start myNewApp blank --type=angular. Let's break this down. The start command will tell the Ionic CLI to generate a new Ionic application. Next, we'll define the project name, myNewApp. The CLI will create a new directory with this name and install the project there.

    After the project name, we'll tell the CLI which template we want to use, in this case, the blank template. Ionic currently has two other templates available, tabs and sidemenu. Depending on your application's navigation design, you can jump start your development.

    The final element in our command is the --type=angular flag. The Ionic CLI supports creating Ionic applications for older versions as well as, soon, for other frameworks like Viewer React. Since we want to create an Ionic 4-based application, we'll set this flag to type of angular.

    With our project generated, we will change our working director to the newly generated one then run the command ionic serve. This will build our application, launch our browser, and load our application for us.

    Now that it's done, we can see the Ionic blank template running in our browser. If we want to make changes to our application, Ionic serve would automatically recompile and reload our application for us.