Prepare for Angular Interviews with real-life questions. Utilize quizzes and examples to deepen understanding and enhance your skills. Gear up to ace your interview!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


Which command is used to install Angular CLI?

  1. npm install angular-cli

  2. npm install -g @angular/cli

  3. install -g @angular/cli

  4. ng install @angular/cli

The correct answer is: npm install -g @angular/cli

The correct command to install Angular CLI is `npm install -g @angular/cli`. This command uses npm (Node Package Manager) to globally install the Angular Command Line Interface (CLI), which is essential for Angular development. The `-g` flag stands for "global," indicating that the Angular CLI will be available for use anywhere on your system, rather than being limited to a specific project. This is important because developers often need to initiate new Angular projects and use various Angular CLI commands across different directories. The package name `@angular/cli` is the correct identifier for the Angular CLI in the npm registry. The `@angular` prefix signifies that it belongs to the Angular framework, and `cli` represents the command line interface component of it. Therefore, using this command allows developers to quickly set up Angular projects and utilize various features of Angular. Other options do not provide the appropriate format or context needed for installing the CLI. For example, simply using `npm install angular-cli` refers to an outdated version of the CLI, while commands that miss the npm context or the `@angular/cli` specification would not successfully install the correct package or might lead to installation errors.