How to install Angular with Typescript
Here's how to install Angular using Node Package Manager.
Step 1 - Angular
Install the latest version of Angular.
npm install -g @angular/cli@latest
Step 2 - Typescript Definitions
Install typescript definitions using @types. @types unifies the management of definitions and packages making for a cleaner install. Good bye typings.
npm install -g @types/npm
Step 3 - Typescript
Install the latest version of Typescript.
npm install -g typescript
Step 4 - Yarn
Install the latest version of Yarn. Yarn is a better package manager than npm
. Yes, it's ironic that you use npm
to install yarn
but in the end, if you want to achieve something similar to Ruby on Rail's "freeze" or bundle package
, yarn is your best bet.
npm install -g yarn
Step 5 - Use yarn instead of NPM
Moving forward, you should try using yarn
instead of npm i
. It will help you experience less dependency hell.
yarn
Step 6 - Create an app
Create a new app and change directory.
ng new myapp && cd myapp
Step 7 - Learn more
There's a lot more to learn about Angular 2. Here's another tutorial on the different types of commands you can run using Angular command line interface.
Troubleshooting Issues
If you have any issues installing Angular, try these troubleshooting solutions.
Resources
- Angular CLI globally.