Questions tagged [angular-cli]

The Angular CLI is a command line interface for building, managing and deploying Angular (version 2+) applications.

The Angular CLI is a command line interface for building, managing and deploying Angular (version 2+) applications. It can be used to generate part of the application, serving in a local server, analysing code quality, etc. It is based on ember-cli project.

Installation

npm install -g @angular/cli

Usage

ng help

Generating and serving an Angular project via a development server

ng new PROJECT-NAME
cd PROJECT-NAME
ng serve

For more information, please visit the following links.

7329 questions
84
votes
4 answers

Angular - Configuration is not set in the workspace

I try to serve my Angular app with my specific configuration but Angular does not recognize it : $ ng serve --configuration=fr An unhandled exception occurred: Configuration 'fr' is not set in the workspace. See "/tmp/ng-nyZPjp/angular-errors.log"…
Noan Cloarec
  • 2,024
  • 2
  • 13
  • 25
84
votes
6 answers

Why no Angular-CLI generate command for 'model' in Angular Project?

While learning up Angular I just went through the various Angular-CLI commands to generate individual parts of Angular like 'Component', 'Services', 'Interface', 'Pipes', etc. Generating Angular Items via Angular-CLI ng g c components/comp-1…
Deadpool
  • 7,811
  • 9
  • 44
  • 88
82
votes
6 answers

What is difference between ng build and ng serve?

What is the difference between ng build and ng serve? What exactly done or changes happen after ng build and ng serve?
Dnyanesh
  • 919
  • 1
  • 8
  • 13
81
votes
19 answers

'ng' is not recognized as an internal or external command, operable program or batch file

I tried running npm install -g angular-cli I also tried adding it to the Enviorment Variables under PATH: (C:\Users\Administrator\AppData\Roaming\npm\node_modules\angular-cli\bin\ng) , with no success also.
SVK
  • 2,107
  • 2
  • 20
  • 41
80
votes
1 answer

What happens when you run ng serve?

I've been using Angular-CLI for the last little while. It comes with a number of commands including ng serve which spins up a server at localhost:4200. I'm used to using Grunt and Gulp which can be configured to suit my needs. I wanted to configure…
Jason Swett
  • 43,526
  • 67
  • 220
  • 351
79
votes
7 answers

How to upgrade Angular CLI project?

I'm attempting to upgrade my angular 2 project from 2.0.0 to 2.4.1. I understand that semantic versioning has been adopted since the 2.0.0 release and 2.x.x releases should be drop-in replacements. My experience seems to indicate otherwise. Maybe…
The Gilbert Arenas Dagger
  • 12,071
  • 13
  • 66
  • 80
77
votes
12 answers

@types/googlemaps/index.d.ts' is not a module

I want to use the Google Maps API with my Angular project, so I used these two commands to install npm packages: npm install @agm/core --save-dev npm install @types/googlemaps --save-dev I added this line to my component: import {} from…
AMendis
  • 1,346
  • 4
  • 18
  • 34
77
votes
3 answers

Difference between ng add vs npm install in angular 6

As Angular6 has been released, They have added a new command ng add . Can anyone tell me what will be the difference between existing command npm install and ng add
Nimish goel
  • 2,561
  • 6
  • 27
  • 42
76
votes
8 answers

Could not resolve dependency: npm ERR! peer @angular/compiler@"11.2.8"

I am trying to get my app to deploy on Heroku. I was getting the "sh: 1: ng: not found" error but based on responses on here, I moved my @angular/cli, @angular-devkit/build-angular, @angular/compiler-cli, and typescript. Now I am getting a "Could…
AylaWinters
  • 1,121
  • 2
  • 7
  • 24
76
votes
10 answers

Angular cli generate a service and include the provider in one step

It is possible generate a service with angular cli and add it as a provider in the app.module.ts in a single step or using an special option in the ng g service command? When a execute: $ ng g service services/backendApi installing service create…
Pablo Ezequiel Inchausti
  • 16,623
  • 7
  • 28
  • 42
76
votes
12 answers

How to insert a Build Number or Timestamp at build time in AngularCLI

I want to have a timestamp or build number somewhere on my Angular2 App so I can tell if a user is using an old cached version or not. How to do this with AngularCLI in Angular2 at AOT compile/build time?
Rodney
  • 5,417
  • 7
  • 54
  • 98
75
votes
11 answers

Call retries were exceeded exception while ng build

I am facing an exception while ng build (generating ES5 bundles for differential loading...) An unhandled exception occured: Call retires were exceeded Used versions: Angular-CLI: 8.3.20 Angular: 8.2.7 Node: 12.12.1 Also in logs, it is…
Savan Gadhiya
  • 1,082
  • 2
  • 11
  • 16
75
votes
5 answers

How to downgrade Angular CLI version?

I'm new in Angular 4 and I am getting this error, Your global Angular CLI version (6.0.1) is greater than your local version (1.4.1). The local Angular CLI version is used. Can you please help me solving this ?
Mukesh Prajapati
  • 786
  • 1
  • 6
  • 12
75
votes
9 answers

Upgrading to angular-6.x gives "Uncaught ReferenceError: global is not defined"

I upgraded my project from angular-5.x to angular-6.x and it started giving the following error and even creation of dummy global variable does not work as given here Angular 6 Auth0 - global not defined The error is as follows: Uncaught…
Atikur Rahman
  • 1,043
  • 1
  • 7
  • 14
75
votes
13 answers

Cannot find module '@angular-devkit/core'

I have created a angular project with Angular CLI: 1.6.3 Node: 9.4.0 OS: linux x64 version. But when want to run my angular app with command ng serve then fetch this error Cannot find module '@angular-devkit/core'.
azmul hossain
  • 1,321
  • 2
  • 11
  • 15