Installing Angular CLI on Ubuntu
The Angular CLI is a command-line interface tool that you use to initialize, develop, and maintain Angular applications.
Installing Angular CLI:
We can install Angular CLI in many ways. In this section, we will be using NPM (Node Package Manager) on Ubuntu. We use the following commands to install Angular CLI.
sudo apt update
sudo apt install nodejs
The nodejs package contains both the node
and npm
binaries.
Now, we will check the node and npm version
sudo node --version
v12.13.1sudo npm --version
6.12.1
If the npm version is old then we can update using the following commands.
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
Now, let’s start Angular CLI using npm.
sudo npm install -g @angular/clisudo ng --version
Now, let’s add a test project using Angular CLI.
ng new my-fisrt-project
This will configure our first Angular project in “my-first-project” directory.
Now, we’ll start our project using the following commands.
cd my-first-project
ng serve --open
Now, open the browser on http://localhost:4200/ to check the running project.
We can follow the next steps to build for production environments, add dependencies and perform other actions.