Last updated November 1, 2022 at 10:13 AM
In this very practical tutorial for the developer, here is how to install angular in ubuntu.
Angular is both a platform and a framework for creating one-page client web applications. It is often used to manage the front-end as we say in IT. We are not going to dwell on the advantages and disadvantages of the latter in this tutorial. This information can be found on the website https://angular.io/ .
[bctt tweet=”Tutorial: How to install angular in ubuntu” username=”tedidevblog”]
How to install angular in ubuntu
We assume that you are a developer and want to quickly set up an angular project in your debian-like linux. In this tutorial we use the ubuntu 16.04 LTS distribution.
To start we will first install AngularCli which is a project management tool. Next we will set up a workspace to create a basic Angular application and at the end we will launch the application.
NB: since we are in a linux system, the terminal will be used throughout the tutorial to enter commands. Make sure to launch it from your menu or using the shortcut Ctrl + Alt + T.
Installing Angular Cli in ubuntu
Angular cli makes it easy to create projects and generate source codes to advance faster in development. We can use angular cli to manage the testing, packaging and deployment of the project. To install it you have to follow the following steps:
- install node js:
sudo apt-get install nodejs
- Type the command:
npm install -g @ angular / cli
Most of the time, as in our case, we had a permission problem. In case of an error like ”Error: EACCES: permission denied, access' / usr / local / lib / node_modules”, run the last command in administrator mode.
-
sudo npm install -g @ angular / cli
Creation of workspace
We develop applications in the Angular workspace. To create it, you must:
- Create the folder that will be used as a workspace: mkdir nom_du_dossier
- Go to the folder: cd nom_du_dossier
- Create the application project with the command:
ng new my app
my app is the name of the application you want to create. If you encounter an error in this step, skip ahead to the troubleshooting section The Angular CLI requires a minimum of Node.js Version Either v10.13 Gold v12.0 to get the solution.
- The previous command ng new my-app will launch a series of questionnaires whose answers will allow you to configure the application being created. Accept the default configuration by pressing the button Starter ou Back
The angular cli tool will install npm packages required for the project with its dependencies. This may take a few minutes.
Once the order is complete, your new workspace containing your first ready-to-use application is created.
Launch the application
The angular Cli tool contains a waiter allowing to build and deploy our application locally. To do this follow the following steps:
- Navigate to the workspace folder you created
- Run these commands:
-
cd my app
-
of serve --open
-
This last command will launch the server and automatically display your first page in the browser under the link http: // localhost: 4200 /. If everything works fine, you will see a page similar to ours:
Last updated November 1, 2022 at 10:13 AM