Questions tagged [angular-cli]

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

Filter by
Sorted by
Tagged with
880 votes
47 answers
1.7m views

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 "@...
ForestG's user avatar
  • 17.4k
510 votes
28 answers
688k views

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 ...
Rich's user avatar
  • 6,428
499 votes
25 answers
729k views

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 ...
Ashutosh Jha's user avatar
  • 15.2k
395 votes
14 answers
287k views

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 ...
Pat M's user avatar
  • 5,936
379 votes
52 answers
1.2m views

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\...
Cristian Muscalu's user avatar
376 votes
23 answers
556k views

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 ...
user avatar
364 votes
18 answers
228k views

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 ...
JDillon522's user avatar
  • 18.9k
361 votes
5 answers
410k views

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 ...
jowey's user avatar
  • 7,511
326 votes
7 answers
383k views

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 ...
Amir Makram's user avatar
  • 11.9k
312 votes
41 answers
743k views

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 ...
Jerome's user avatar
  • 4,442
311 votes
29 answers
316k views

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's user avatar
  • 7,086
310 votes
14 answers
548k views

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's user avatar
  • 14.3k
287 votes
6 answers
158k views

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 ...
Jek's user avatar
  • 5,516
279 votes
12 answers
218k views

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's user avatar
  • 3,397
261 votes
34 answers
400k views

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 ...
Elmer Dantas's user avatar
  • 4,649
248 votes
16 answers
262k views

How to execute only one test spec with angular-cli

I have Angular2 project build with Angular-CLI (beta 20). Is there a way to run tests against only one selected spec file? I used to have a project based on Angular2 quick start, and I could ...
Zielu's user avatar
  • 8,272
246 votes
8 answers
201k views

How to set environment via `ng serve` in Angular 6

I am trying to update my Angular 5.2 app to Angular 6. I successfully followed instructions in the Angular update guide (including the update of angular-cli to v6), and now I am trying to serve the ...
Martin Adámek's user avatar
243 votes
15 answers
181k views

Running a single test file

Is there a way to run ng test for a single file instead of for the entire test suite? Ideally, I'd like to get the quickest possible feedback loop when I'm editing a file, but karma executes the ...
Elliot Larson's user avatar
231 votes
17 answers
583k views

Checking version of angular-cli that's installed?

Is there a way to check the specific version of angular-cli that's installed globally on my machine? I'm in a Windows environment. *npm -v* and *node -v* only gives me the version of npm and node ...
bunndan's user avatar
  • 2,717
212 votes
6 answers
253k views

When to use 'npm start' and when to use 'ng serve'?

ng serve serves an Angular project via a development server   npm start runs an arbitrary command specified in the package's "start" property of its "scripts" object. If no "start" property ...
ishandutta2007's user avatar
205 votes
45 answers
712k views

Angular CLI Error: The serve command requires to be run in an Angular project, but a project definition could not be found

When running the terminal commands ng server or ng serve --live-reload=true, I'm getting this issue: The serve command requires to be run in an Angular project, but a project definition could not ...
Gurpreet Singh's user avatar
201 votes
17 answers
206k views

Angular-cli from css to scss

I've read the documentation, which says that if I want to use scss I have to run the following command: ng set defaults.styleExt scss But when I do that and make that file, I still receive this ...
Jamie's user avatar
  • 10.1k
201 votes
11 answers
556k views

How to load image (and other assets) in Angular an project?

I'm pretty new to Angular so I'm not sure the best practice to do this. I used angular-cli and ng new some-project to generate a new app. In it created an "images" folder in the "assets" folder, ...
user3183717's user avatar
  • 4,357
198 votes
21 answers
552k views

How to get the Angular version?

I installed the @angular/cli package via npm using: npm install -g @angular/cli The version 1.4.2 of @angular/cli has been successfully installed. That is not the Angular version, but the CLI version....
vinibrsl's user avatar
  • 6,473
197 votes
23 answers
288k views

Error: Local workspace file ('angular.json') could not be found

I have travis-ci integrated with my GitHub account (https://github.com/pradeep0601/Angular5-Router-App). When I updated @angular/cli version from 1.7.4 to 6.0.0-rc.3, the build started failing with ...
Pradeep's user avatar
  • 12.3k
197 votes
13 answers
301k views

Set default host and port for ng serve in config file

I want to know if i can set a host and a port in a config file so I don't have to type ng serve --host foo.bar --port 80 instead of just ng serve
cre8's user avatar
  • 13k
195 votes
42 answers
389k views

ng: command not found while creating new project using angular-cli

Installed angular-cli globally using (npm install -g angular-cli) but when I'm trying to create project using ng new my-project it is throwing error: ng: command not found
lego's user avatar
  • 2,051
191 votes
43 answers
578k views

Message "the term 'ng' is not recognized as the name of a cmdlet"

Today, while working through some basic AngularJS introduction, I ran into a problem. I opened PowerShell to get going on the project. NPM worked. I was able to install Angular using: npm install -g @...
Wauna's user avatar
  • 2,168
188 votes
33 answers
266k views

How to change Angular CLI favicon

How can I change the default favicon that is set by the Angular CLI? I have tried many things, but it always shows the Angular logo as the favicon, even though I have deleted that icon (favicon.ico ...
user avatar
181 votes
16 answers
185k views

How to decrease prod bundle size?

I have a simple app, initialized by angular-cli. It display some pages relative to 3 routes. I have 3 components. On one of this page I use lodash and Angular 2 HTTP modules to get some data (using ...
BlackHoleGalaxy's user avatar
177 votes
9 answers
166k views

ERROR in The Angular Compiler requires TypeScript >=3.1.1 and <3.2.0 but 3.2.1 was found instead

I am getting this error ERROR in The Angular Compiler requires TypeScript >=3.1.1 and <3.2.0 but 3.2.1 was found instead. Seems like Typescript updated but the Angular Compiler doesn't like ...
Matt's user avatar
  • 32.9k
175 votes
6 answers
198k views

How to iterate using ngFor loop Map containing key as string and values as map iteration

I am new to angular 5 and trying to iterate the map containing another map in typescript. How to iterate below this kind of map in angular below is code for component: import { Component, OnInit} ...
Feroz Siddiqui's user avatar
167 votes
20 answers
763k views

How to uninstall/upgrade Angular CLI?

When I try to create a new project with Angular CLI, with: ng n app I get this error: fs.js:640 return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode); ...
RohanArihant's user avatar
  • 2,540
167 votes
3 answers
138k views

"Error: No provider for router" while writing Karma-Jasmine unit test cases

We have done one angular2 project set up and inside that created one module (my-module) and inside that module created one component (my-new-component) using following cmd commands: ng new ...
Partha Sarathi Ghosh's user avatar
161 votes
25 answers
537k views

How to install a specific version of Angular with Angular CLI?

I searched through google and angular cli doc but couldn't find any way to install a specific version of Angular using Angular CLI. is it even possible?
Sajad's user avatar
  • 3,226
158 votes
10 answers
230k views

Repository is not clean. Please commit or stash any changes before updating In Angular 8

Error Repository is not clean. Please commit or stash any changes before updating when i have updated from version 7 to Angular 8. Angular Guide for upgrade https://update.angular.io/#7.0:8.0 ...
afeef's user avatar
  • 4,336
157 votes
9 answers
151k views

angular-cli server - how to specify default port

Using angular-cli with the ng serve command, how can I specify a default port so I do not need to manually pass the --port flag every time? I'd like to change from the default port 4200.
elwyn's user avatar
  • 10.3k
156 votes
14 answers
299k views

how to end ng serve or firebase serve

I've been doing web development with Angular2 and have been using both Angular2 and Firebase to run local servers. I haven't been able to find a command similar to typing quit when using Ionic to ...
aheigins's user avatar
  • 2,524
154 votes
10 answers
208k views

how to change the dist-folder path in angular-cli after 'ng build'

I would like to use angular-cli with asp.net core and I need to know how I can change the path of the dist folder
cuppy's user avatar
  • 1,651
154 votes
11 answers
60k views

Angular tests failing with Failed to execute 'send' on 'XMLHttpRequest'

I am trying to test my angular 4.1.0 component - export class CellComponent implements OnInit { lines: Observable<Array<ILine>>; @Input() dep: string; @Input() embedded: boolean; @...
George Edwards's user avatar
150 votes
27 answers
205k views

You seem to not be depending on "@angular/core". This is an error

I want to create an angular 2 App with angular cli I have written in the cmd: npm install angular-cli -g then: ng firstngapp but it show me an error when I write npm start ! I don't ...
web_mobile designer_dev's user avatar
148 votes
25 answers
167k views

"Invalid Host header" when running Angular/cli development server c9.io

Current command: ng serve --host --public $IP:$PORT Results on my website: Invalid Host header
Olejs's user avatar
  • 1,597
148 votes
23 answers
137k views

How to get rid of the warning .ts file is part of the TypeScript compilation but it's unused

I Just updated angular to latest 9.0.0-next.4. I am not using routing but suddenly after updating I keep seeing this warning. How Do I remove this warning WARNING in src/war/angular/src/app/app-...
dota2pro's user avatar
  • 7,100
148 votes
4 answers
125k views

angular-cli where is webpack.config.js file - new angular6 does not support ng eject

UPDATE: December 2018 (see 'Aniket' answer) With Angular CLI 6 you need to use builders as ng eject is deprecated and will soon be removed in 8.0 UPDATE: June 2018: Angular 6 does not support ng ...
stackdave's user avatar
  • 6,605
148 votes
12 answers
35k views

Implementing a plugin architecture / plugin system / pluggable framework in Angular 2, 4, 5, 6

Update 5/24/2018: We are now +3 versions of Angular from my original post and still don't have a final workable solution. Lars Meijdam (@LarsMeijdam) has come up with an interesting approach which is ...
Anthony Gatlin's user avatar
144 votes
5 answers
164k views

What's the difference between --base-href and --deploy-url parameters of angular-cli tool

The documentation of Angular informs one should use --base-href parameter in the Angular application build for production when it's going to be deployed in a subfolder: If you copy the files into a ...
Rodrigo's user avatar
  • 2,273
143 votes
12 answers
227k views

Get angular-cli to ng serve over HTTPS

The following doesn't seem to do anything. ng serve --ssl true --ssl-key <key-path> --ssl-cert <cert-path> Creating the Certificate and key by providing them in the default ssl directory ...
grim_i_am's user avatar
  • 3,594
140 votes
8 answers
137k views

Cannot find name 'require' after upgrading to Angular4

I want to use Chart.js within my Angular project. In previous Angular2 versions, I have been doing this well by using a 'chart.loader.ts' which has: export const { Chart } = require('chart.js'); ...
Thomas Wang's user avatar
  • 2,031
140 votes
7 answers
101k views

How to include custom files with angular-cli build?

RE: Angular2 2.0.0, angular-cli v1.0.0-beta.11-webpack.8 How do I tell angular-cli to include a file from "src/assets" in the root of "dist" when it builds? We deploy to a Windows host and need to ...
Kizmar's user avatar
  • 2,455
134 votes
13 answers
325k views

angular-cli server - how to proxy API requests to another server?

With the angular-cli ng serve local dev server, it's serving all the static files from my project directory. How can I proxy my AJAX calls to a different server?
elwyn's user avatar
  • 10.3k

1
2 3 4 5
147