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

Angular-CLI proxy to backend doesn't work

https://github.com/angular/angular-cli#proxy-to-backend here is an instruction how to do proxying to backend. I did everything step by step and still requests aren't proxied. 8080 - my Express backend 4200 - my Angular2 frontend In Angular2 project…
elzoy
  • 5,237
  • 11
  • 40
  • 65
60
votes
6 answers

Cannot find module 'webpack' - Angular

I just migrated my project from angular v5.x to v6.x and now when I try to start it with ng serve I'm getting: Cannot find module 'webpack' Error: Cannot find module 'webpack' at Function.Module.... any help ? I cleared node modules and: npm…
kosnkov
  • 5,609
  • 13
  • 66
  • 107
59
votes
2 answers

How to add a routing module to an existing module in angular CLI version 1.1.1?

I have created a module in using angular CLI and forget to add --routing while it's creation, now i want to add a routing module to it. ng init --routing won't help in angular CLI version 1.1.1
Gourishankar
  • 906
  • 1
  • 7
  • 14
58
votes
2 answers

Angular CLI custom webpack config

In previous versions of Angular there was an option for eject so that you could modify your webpack configuration as you please. One of the most common use cases for this feature was adding custom webpack loaders. In Angular 6 this option has been…
JeB
  • 11,653
  • 10
  • 58
  • 87
58
votes
6 answers

SCSS Import Relative to Root

I'm in the process refactoring an Angular application and as I'm moving components around to new directory locations, I'm finding that dealing @import paths in the components' SCSS files is getting a bit tedious. For example, let's say I have the…
Steve
  • 11,596
  • 7
  • 39
  • 53
58
votes
16 answers

Electron - Not allowed to load local resource

Evening, I'm looking into using electron to package an existing angular2 build. I thought I had a dry run working but the actual packaging seems to be failing (see final step below) and I want to understand why. Here's what I'm doing... Create…
popClingwrap
  • 3,919
  • 5
  • 26
  • 44
58
votes
3 answers

Angular 2 - Global CSS file

Is it possible to add a global CSS file to Angular 2? At the moment I have many different components that have the same button styling - but each of the components have their own CSS file with the styling. This is frustrating for changes. I read…
dandev91
  • 1,691
  • 3
  • 22
  • 34
57
votes
2 answers

Angular 12 CSS optimization inline event handler with Content Security Policy

After upgrading to Angular 12 my Content Security Policy blocks styles from loading correctly. The Angular 12 devkit seems to add a new inline event handler to the CSS bundle reference in index.html, example below.
Alex Moss
  • 571
  • 1
  • 4
  • 5
57
votes
8 answers

How to install npm package while offline?

I'm working on an offline network and want to install angular-cli using npm. I have a zip file of angular-cli and using the latest node and npm version. I'm using the command: npm install ./angular-cli-master to install angular-cli from the…
Dorni
  • 699
  • 1
  • 5
  • 13
56
votes
1 answer

"constructorParametersDownlevelTransform is not a function" in Angular

I had to run an "npm audit fix" on my project and from there after all "ng serve", I get the following error: ERROR in TypeError: tooling_1.constructorParametersDownlevelTransform is not a function Has anyone ever experienced this? Thank…
René Gustavo
  • 693
  • 1
  • 5
  • 7
54
votes
1 answer

what is the real difference between ng test and ng e2e

I am afraid someone close my question but I couldn't find a satisfying question (maybe because I am very limited in Angular 2+ world and I understood something wrong). As far as I could understand after few Hello World done and few YouTube demo…
Jim C
  • 3,957
  • 25
  • 85
  • 162
53
votes
6 answers

Can angular-cli remove unused css?

so far the smallest bundle I can create with angular cli is by running ng build --aot true -prod I was wondering if the build process also removes unused css classes e.g. from bootstrap? If not how can I add libraries like purifycss to it? EDIT…
Han Che
  • 8,239
  • 19
  • 70
  • 116
52
votes
4 answers

Angular 6 / 7 "the result of a dependency is an expression"

I'm trying to create an Angular 6 library and use it in an Angular 6 app. I've boiled it down to a minimal test case. (Update: since Angular 7 is out, I've tried that as well.) ng new workspace # accept the defaults ng new product # accept the…
Patrick McElhaney
  • 57,901
  • 40
  • 134
  • 167
51
votes
5 answers

Angular 15 CLI does not create environments folder when creating an angular project via ng new

Similar to an Angular 14 generated project I want to have separate development and production environments but when creating a project using ng new: ng new my-app this does not create the environments folder or set this up.
Mohamed Abouelnasr
  • 630
  • 1
  • 3
  • 8
51
votes
7 answers

[ng update]: Error - The "@angular-devkit/schematics" package cannot be resolved from the workspace root directory

ng update The "@angular-devkit/schematics" package cannot be resolved from the workspace root directory. This may be due to an unsupported node modules structure. Please remove both the "node_modules" directory and the package lock file; and…
Satish Singh
  • 2,169
  • 3
  • 23
  • 32