IONIC - 2.2 Installing IONIC

Click here for more videos available on our youtube channel !

Now that Node.js is installed, we can install Ionic on our system. To do that, we use a CLI: CLI stands for Command Line Interface, the tool that lets us interact with our system from the terminal. We go to the official Ionic installation page and copy the install command, then paste it into our terminal.

The command to install the Ionic CLI globally is:

npm install -g @ionic/cli

On macOS or Linux, prefix it with sudo if needed and enter your password when prompted; on Windows the sudo prefix is not required. Once the installation is complete, the Ionic CLI is available from anywhere in the terminal: we can use it to create new Ionic projects, run them, build apps and so on.

Creating and running your first Ionic project

In the terminal, navigate to the folder where you want your new Ionic project to live, then run ionic start. The CLI asks a few questions. First, the project name: I chose ionic-angular-course, but feel free to pick any name. Then you choose the framework you want to work with, for example Angular or React. Finally, you pick a starter template: blank for a totally empty project to build from scratch, sidemenu for a page with a side menu, or tabs for an app with a tab menu. We pick blank, which generates a new project and installs all dependencies, including Angular and the Ionic libraries. This download takes a moment, so let it finish before going further.

Once it is done, navigate into the newly created project folder and run:

ionic serve

The Ionic CLI then starts a development server that runs your application, and you can see your first Ionic app in the browser. That is it for this first part on installing and starting an Ionic project. If you run into issues during the installation, do not hesitate to rewatch the video and to check the documentation — sites like Stack Overflow are also a great help. In the next video, we will start customizing this Ionic application.