When I tried to run my Application, I got this exception

“The NPM script ‘start’ exited without indicating that the Angular CLI was listening for requests”

Background:

I was working on a project using Angular 5 SPA(Single Page Application) Template in Asp.Net Core 2.1. I created .net core application having Angular Cli support which is a really nice way to work with Angular.

Full Exception was something like this:

An unhandled exception occurred while processing the request.

AggregateException: One or more errors occurred. (One or more errors occurred. (The NPM script ‘start’ exited without indicating that the Angular CLI was listening for requests. The error output was: Unknown option: ‘–extractCss

InvalidOperationException: The NPM script ‘start’ exited without indicating that the Angular CLI was listening for requests. The error output was: Unknown option: ‘–extractCss

I thought that like most of the times angular application throw exceptions due to missing upgrades so I tried all the steps below but the problem was still there:

npm install -g @angular/cli
 npm install @angular/cli
 ng update @angular/cli
 ng update @angular/coresa

after wasting hours I finally managed to solve my problem.

Solution:

I edited my package.json file and remove the –extractCss parameter from the start and build property.

Click the Button Below to View Solution Code Example.

“scripts”: { “ng”: “ng”, “start”: “ng serve –extract-css”, “build”: “ng build –extract-css”,

to:

“scripts”: { “ng”: “ng”, “start”: “ng serve”, “build”: “ng build”,

 

Comment if you find this solution helpful or still facing the problem.

 

Disclosure of Material Connection: Some of the links in the post above are “affiliate links.” This means if you click on the link and purchase the item, we will receive an affiliate commission. Regardless, we only recommend products or services we use personally and believe will add value to our readers.

Author

I'm passionate about learning new technologies as well as mentoring and helping others get started with their programming career. This blog is my way of giving back to the Community.

3 Comments

  1. michael courter

    This worked for me. Why does it work?