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
75
votes
11 answers

How to install Angular CLI locally (without the -g flag)

I've just started working with Angular and with Angular-CLI and I've seen that, according to the documentation, I need to install $ npm install -g @angular/cli with the -g (global) flag. However I would like to have Angular-CLI installed locally…
Gil Epshtain
  • 8,670
  • 7
  • 63
  • 89
74
votes
3 answers

How do I add Sass compilation in Angular CLI 6: angular.json?

I just created a new Angular project using the new Angular CLI 6.0, but I need to add Sass compilation to my project. I'm aware you can set a flag when you create a project, but my project is already created and work has been done. The new…
Esten
  • 1,385
  • 2
  • 12
  • 21
74
votes
4 answers

Angular CLI output - how to analyze bundle files

I am using Angular CLI to build an app for production using the --prod switch. The bundle is created in the dist directory. Is there a way to know which classes and functions have been actually put in the bundle after tree-shacking and all other…
Picci
  • 16,775
  • 13
  • 70
  • 113
73
votes
4 answers

What is the use of polyfills.ts file in Angular

polyfills.ts file is auto generated while creating an Angular application using Angular Cli. Can anyone explain me what is the use of polyfills.ts file in Angular application.
Praveen Ojha
  • 1,161
  • 1
  • 14
  • 22
73
votes
3 answers

Angular4 Application running issues in IE11

I am building a Angular4 project using Angular CLI (1.1.2). It runs perfectly in Chrome (Version 59.0.3071.115) and firefox(54.0.1) but when I tried to use IE11 (Verison 11.0.9600.18738) nothings shows up and when I open the develper mode in IE, it…
Terry Zhang
  • 4,541
  • 8
  • 23
  • 29
72
votes
5 answers

Angular CLI 6: Where to put library dependencies

I'm converting a library (ng-app-state) to use the angular cli, now that v6 supports libraries (yay!). After scaffolding and copying in some code, here is my first question: How/where do I add 3rd party dependencies? To package.json, or to…
Eric Simonton
  • 5,702
  • 2
  • 37
  • 54
72
votes
5 answers

How to use Bootstrap 4 with SASS in Angular

I'd like to use Bootstrap 4 with SASS in an Angular(4+) project created with Angular CLI. In particular I need to: use SASS instead of CSS both as global style and Component-style compile Bootstrap SASS source together with my custom *.scss…
Francesco Borzi
  • 56,083
  • 47
  • 179
  • 252
72
votes
6 answers

How to run my Angular site on mobile device that is running localhost on my windows desktop

I know from this question and answer on Super User Site running on localhost on desktop is unreachable on android device (PS: this question continues on the question in the link) that the command ng serve opens a bad configured webserver. The…
H. Pauwelyn
  • 13,575
  • 26
  • 81
  • 144
71
votes
13 answers

Stop angular cli asking for collecting analytics when I use ng build

Angluar CLI is asking the following question when I am trying to build and deploy my project using gitlab CI/CD: > @angular/cli@8.0.0 postinstall /workspace/node_modules/@angular/cli > node ./bin/postinstall/script.js ? Would you like to share…
Arman Fatahi
  • 2,635
  • 3
  • 24
  • 37
70
votes
4 answers

WARNING in Exceeded maximum budget for SCSS FILE IN ANGULAR

IMPORTING BOOTSTRAP VARIABLE in SCSS file getting error WARNING in Exceeded maximum budget for B:/Angular-8/crats-shop/src/app/shared/components/sort/sort.component.scss. Budget 6 kB was not met by 136 kB with a total of 142 kB
aishvarya
  • 721
  • 1
  • 5
  • 7
70
votes
4 answers

Correct way of importing and using lodash in Angular

I used to be able to use a lodash method in Angular by an import statement that looked like the following: import {debounce as _debounce} from 'lodash'; I now get the following error when using that…
jloosli
  • 2,461
  • 2
  • 22
  • 34
70
votes
4 answers

How to include assets from node_modules in angular cli project

How to include assets from external library into Angular CLI project I am trying below but this does not work, "assets": [ "../node_modules//assets/" ] Scripts are working fine though, "scripts": [ …
Madhu Ranjan
  • 17,334
  • 7
  • 60
  • 69
70
votes
8 answers

Avoiding relative paths in Angular CLI

I'm using the latest Angular CLI, and I've created a custom components folder which is a collection of all components. For example, TextInputComponent has a TextInputConfiguration class which is placed inside src/components/configurations.ts, and in…
Pratik Kelwalkar
  • 1,592
  • 2
  • 15
  • 21
69
votes
18 answers

Installing npm package fails with 404

Using the command prompt, I am trying to install angular CLI and it fails. I have npm version 5.5.1 and node version v8.9.1. I am trying to install angular cli using the command npm install -g @angular/cli@latest and it fails with the…
theandroid
  • 809
  • 1
  • 6
  • 13
68
votes
36 answers

Syntax Error in Angular App: Unexpected token <

I have an Angular app which runs perfectly in my local and production environment.. After a tiny change I made, I ran the app locally and it works fine.. Then I built the project and copied the dist folder to the web server. The problem is when I…
Gerardo Tarragona
  • 1,185
  • 4
  • 15
  • 28