Setting up Angular 2 development environment
How to setup an Angular 2 development environment.
For this tutorial we are going to setup using the command line interface or CLI which is easiest way of setting up an angular information, i'm on a PC and and we will know about the setup on Linux and Mac(setup won't differ much though) in the later tutorials.
Preparing the CLI for Angular 2 Setup
In order install Angular 2 in our PC, we need to have Node Packet Manager (NPM) pre-installed because Angular applications and Angular itself depend upon features and functionality provided by a variety of third-party packages. These packages are maintained and installed with the Node Package Manager (NPM)
.
If you have Node Js installed in your system already, just ignore and if you don't have it pre-installed you can get it at nodejs.org. Please make sure that you have installed latest version of Node js (Angular installation requires version 6.x or higher)
You can always check the installation by opening CMD by hitting Win + R and typing
cmd
which opens a command window where you can write
node -v
. If the system returns the version number of the Node then you have installed the Node Js in your system successfully and if not, you need to check your installation once again
Checking the availability of Typescript
We need to check if our PC is compatible with Typescript. Typescript is a super set of JavaScript language and we need the compatibility of Typescript because Angular 2 is built on Typescript. The installation of typescript will be default on Angular installation, but in some cases we need to install it manually in order to support the installation of Angular which can be done easily through CLI (thanks to NPM).
In order to install Typescript in your system, open windows command prompt and type
npm install -g typescript
and hit enter, this will install the latest version of typescript into your system.
Alternatively you can install it manually by going to the Typescript website, downloading the package, installing it and adding it's current path to our environment variables of the system.
We can check the installation of typescript by typing
typescript -v
in the command prompt, which returns the latest version of the typescript installed in the system.
Installing Angular 2
This is the final step in installing Angular 2 development environment on your PC.
In order to install Angular 2, you need to open command prompt and type
npm install -g angular -cli
.
This will install latest version of Angular 2 in your system. Now your Angular 2 development environment is setup
You can create your first angular application by typing
ng new Appname
in command window
Important Note
In the upcoming releases of Angular 2 the command
npm install -g angular -cli
shall be deprecated with
npm install -g angular/cli
.
That's all for this post, Thank you
angular,development
Comments for this post