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
883
votes
47 answers

Angular 6 - Could not find module "@angular-devkit/build-angular"

After updating to Angular 6.0.1, I get the following error on ng serve: Could not find module "@angular-devkit/build-angular" from "/home/Projects/myProjectName". Error: Could not find module "@angular-devkit/build-angular" from…
ForestG
  • 17,538
  • 14
  • 52
  • 86
513
votes
29 answers

Global Angular CLI version greater than local version

When running ng serve I get this warning about my global CLI version being greater than my local version. I don't notice any issues from this warning, but I was wondering if the two versions should be in sync? Also, Is it necessary to have a local…
Rich
  • 6,470
  • 15
  • 32
  • 53
507
votes
25 answers

How to change angular port from 4200 to any other

I want to use 5000 instead of 4200. I have tried to create a file on root name ember-cli and put JSON according to the code below: { "port": 5000 } But my app still runs on 4200 instead of 5000
Ashutosh Jha
  • 15,451
  • 11
  • 52
  • 85
397
votes
14 answers

How to bundle an Angular app for production

What is the best method to bundle Angular (version 2, 4, 6, ...) for production on a live web server. Please include the Angular version within answers so we can track better when it moves to later releases.
Pat M
  • 5,966
  • 7
  • 24
  • 34
382
votes
23 answers

How to generate components in a specific folder with Angular CLI?

I am using Angular 4 with Angular CLI and I am able to create a new component with the following command. E:\HiddenWords>ng generate component plainsight But I need to generate a child component inside plainsight. Is there a way to do it with…
user8520658
381
votes
53 answers

ng is not recognized as an internal or external command

Running windows 7 Professional 32bit. I tried running npm install -g angular-cli both under normal or admin. I also tried adding it to the Enviorment Variables under PATH: (C:\Users\Administrator\AppData\Roaming\npm\node_modules\angular-cli\bin\ng)…
Cristian Muscalu
  • 9,007
  • 12
  • 44
  • 76
368
votes
5 answers

Is there a compatibility list for Angular / Angular-CLI and Node.js?

I periodically run into the problem, having to spin up old Angular projects with deprecated dependencies of Angular. Because I unsually run the latest Node.js version (at least lates LTS version) I often had the problem, that I wasn't able to get…
jowey
  • 7,581
  • 6
  • 27
  • 46
365
votes
18 answers

Angular CLI SASS options

I'm new to Angular and I'm coming from the Ember community. Trying to use the new Angular-CLI based on Ember-CLI. I need to know the best way to handle SASS in a new Angular project. I tried using the ember-cli-sass repo to see if it would play…
JDillon522
  • 19,046
  • 15
  • 47
  • 81
330
votes
8 answers

Why powershell does not run Angular commands?

I have started to learn Angular but I note that powershell in Windows gives me an error whenever I make an angular command like: ng new new-app or ng serve this is the error what I got: ng : File C:\Users\< username >\AppData\Roaming\npm\ng.ps1…
Amir Makram
  • 12,030
  • 3
  • 13
  • 25
315
votes
42 answers

How to add bootstrap to an angular-cli project

We want to use bootstrap 4 (4.0.0-alpha.2) in our app generated with angular-cli 1.0.0-beta.5 (w/ node v6.1.0). After getting bootstrap and its dependencies with npm, our first approach consisted in adding them in…
Jerome
  • 4,472
  • 4
  • 18
  • 18
312
votes
14 answers

What is the best way to delete a component with CLI

I tried using "ng destroy component foo" and it tells me "The destroy command is not supported by Angular-CLI" How do we properly delete components with Angular CLI?
Jus10
  • 14,519
  • 21
  • 52
  • 77
311
votes
29 answers

How to add font-awesome to Angular 2 + CLI project

I'm using Angular 2+ and Angular CLI. How do I add font-awesome to my project?
Nik
  • 7,086
  • 6
  • 36
  • 52
289
votes
6 answers

tslint / codelyzer / ng lint error: "for (... in ...) statements must be filtered with an if statement"

Lint error message: src/app/detail/edit/edit.component.ts[111, 5]: for (... in ...) statements must be filtered with an if statement Code snippet (It is a working code. It is also available at angular.io form validation section): for (const…
Jek
  • 5,546
  • 9
  • 37
  • 67
284
votes
12 answers

How to rename a component in Angular CLI?

Is there any shortcut to rename a component with the Angular CLI other than manually editing all the component files such as folder name, .css, .ts, spec.ts and app.module.ts?
Thomas Easo
  • 3,457
  • 3
  • 21
  • 32
261
votes
34 answers

Create component & add it to a specific module with Angular-CLI

I'm starting to use angular-cli and I've already read a lot to find an answer about what I want to do...no success, so I came here. Is there a way to create a component to a new module? e.g.: ng g module newModule ng g component newComponent (how…
Elmer Dantas
  • 4,649
  • 5
  • 30
  • 36
1
2 3
99 100