Requirements To install Angular 5
In order to install and run Angular 5 CLI Version, you have to install following elements in your environment.
- Node.js (Node 4 or higher)
- npm (NPM 3 or higher)
- Angular CLI
Installing Nodejs latest version
If you are PC(Window) or OS X (Mac) user then you can install latest version of node from Node official website
https://nodejs.org/en/download/ using one of the installers and follow the steps.
For linux please follow this tutorial Installing Nodejs on Ubuntu
Checking installed version of Node
Installing node will install npm automatically, however version of npm is updated more frequently then Node.It is recommed to update your npm to latest available version. To update your npm version run below command on your terminal or command promt.
npm install npm@latest -g You may also Like Angular 5 interview questions
Installing Angular CLI
After installing Node js and updating your npm the next step is to install Angular CLI.Angular CLI is Command line interface for create and managing Angular applications. It based on the ember-cli project. To install angular cli run below command on your terminal.
npm install -g angular-cli
Creating Angular 5 Project.
To create Angular 5 Project run following commands
ng new myApp --skip-install
You can create an angular project by running ng new yourprojectname command, we have added –skip-install option we angular 5 is not released yet offically. –skip-install option tells NPM to skip the project dependencies to install automatically. We will install our dependencies manually by updating projects package.json
Once installation of the Angular project is completed successfully, change your directory to projects directory.
Next open your package.json and replace all angular dependencies from ^4.2.4 to ^5.0.0-rc.1 and Typescript ~2.3.3 to ~2.4.1 and save it.
Now come back on your terminal and run below commnad to install all project dependencies
Running your Angular 5 project
To running your Angular 5 project, rum below command on command propmt
Output : ** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
The ng serve command launches the server, watches your files, and rebuilds the app as you make changes to those files.
Open http://localhost:4200/ URL in your browser to browse the App.