Installing Angular 7 CLI

Go back to Tutorial

To install the Angular CLI, execute the command:

npm install -g @angular/cli

If you get an error installing the CLI, this is an issue with your local npm setup on your machine, not a problem in Angular CLI.

Verifying Installation

Generating and serving an Angular project via a development server Create and run a new project:

ng new my-project

cd my-project

ng serve

Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Installing a specific version

The CLI is installed both globally (the command above with the -g argument to npm install) and also within the project. To install a different version of the CLI, you can just update the version locally within your project. The globally installed package will always delegate to the local one.

There are several different versions available at any time:

  • Install a previous version, maybe because of a bug in the latest version. For example to get 7.0.2: npm install @angular/[email protected]
  • Install the pre-release of a newer minor/major version, to try new features. For example to get 7.0.0-beta.3: npm install @angular/[email protected] Note that the @next version is only useful during beta periods.
  • Install a snapshot build from the latest passing run of our CI (angular-cli/master). This is useful if an issue was just fixed or a new feature just landed on master, but is not yet released: npm install @angular/[email protected]:angular/cli-builds (or maybe better, find the particular SHA that you want to try: npm install @angular/[email protected]:angular/cli-builds#0123456789abcdef)

Go back to Tutorial

Get industry recognized certification – Contact us

Menu