NPM脚本“开始”退出,但未指示Angular CLI正在侦听请求 [英] The NPM script 'start' exited without indicating that the Angular CLI was listening for requests

查看:123
本文介绍了NPM脚本“开始”退出,但未指示Angular CLI正在侦听请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试启动.NET Core 2 / Angular 6 SPA。我使用 dotnet new angular创建了Angular 5应用程序,然后使用angular.io中的本指南进行了升级。升级完成后,我尝试使用 dotnet run运行该应用程序,但出现一个错误的丑陋错误页面:


处理请求时发生未处理的异常。



AggregateException:发生一个或多个错误。 (发生一个或多个错误
。(退出NPM脚本开始,但未指示
Angular CLI正在侦听请求。错误输出为:Unknown
选项:'--extractCss '



InvalidOperationException:NPM脚本 start已退出但未指示Angular CLI正在侦听请求。错误输出为:未知选项:'--extractCss'


认为也许我在升级过程中错过了一步,所以我尝试了第二次并遇到相同的错误。



这是我创建应用程序后采取的步骤:

  npm install -g @ angular / cli 
npm安装@ angular / cli
ng更新@ angular / cli
ng更新@ angular / core
npm install-保存@ angular / material @ angular / cdk @angular / animations Hammerjs
npm install -g rxjs-tslint
rxjs-5-to-6-migrate -p src / tsconfig.app.json


关于如何解决此问题的任何想法?这是完整的堆栈跟踪:

  ---> System.IO.EndOfStreamException:尝试读取流的末尾。 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()中的
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)中的
Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware中的
。 ; StartAngularCliServerAsync> d__3.MoveNext()
-内部异常堆栈跟踪的末尾--- Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware的
。< StartAngularCliServerAsync> d__3.MoveNext()
-内部异常堆栈跟踪的结束--- System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
在Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware。< ;>< bttacht> b__2_0(System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
在System.Threading.ExecutionContext.Run(ExecutionContext executeContext, ContextCallback回调,对象状态)System.Threading.Tasks.Task.Execu上的
teWithThreadLocal(Task& currentTaskSlot)
-内部异常堆栈跟踪的结尾---
在System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
在Microsoft.AspNetCore.SpaServices.Extensions .Util.TaskTimeoutExtensions。< WithTimeout> d__1`1.MoveNext()
-从上次引发异常的位置开始的堆栈跟踪--- System.Runtime.ExceptionServices.ExceptionDispatchInfo处的
。 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)
在Microsoft.AspNetCore.SpaServices.Extensions.Proxy.SpaProxy。< PerformProxyRequest> d__4.MoveNext()
b-从先前抛出异常的位置开始的堆栈结束跟踪--System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task任务)Microsoft.AspNetCore.Builder.SpaProxyingExtensions中的
。<> c__DisplayClass 2_0。<< UseProxyToSpaDevelopmentServer> b__0> d.MoveNext()
-从上次引发异常的位置开始的堆栈结束跟踪--- System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw处的
()
在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)
在Microsoft.AspNetCore.Builder.RouterMiddleware。< Invoke> d__4.MoveNext()
---结束从上一个引发异常的位置开始的堆栈跟踪信息--- System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)中的
b在Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware。< Invoke> d__7.MoveNext()
---> (内部异常#0)System.AggregateException:发生一个或多个错误。 (退出NPM脚本开始时未指示Angular CLI正在侦听请求。错误输出为:未知选项:``--extractCss

)---> System.InvalidOperationException:NPM脚本开始已退出,但未指示Angular CLI正在侦听请求。错误输出为:未知选项:’--extractCss’

---> System.IO.EndOfStreamException:尝试读取流的末尾。 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()中的
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)中的
Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware中的
。 ; StartAngularCliServerAsync> d__3.MoveNext()
-内部异常堆栈跟踪的末尾--- Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware的
。< StartAngularCliServerAsync> d__3.MoveNext()
-内部异常堆栈跟踪的结束--- System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
在Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware。< ;>< bttacht> b__2_0(System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
在System.Threading.ExecutionContext.Run(ExecutionContext executeContext, ContextCallback回调,对象状态)System.Threading.Tasks.Task.Execu上的
teWithThreadLocal(Task& currentTaskSlot)
---> (内部异常#0)System.InvalidOperationException:NPM脚本 start已退出,但未指示Angular CLI正在侦听请求。错误输出为:未知选项:’--extractCss’

---> System.IO.EndOfStreamException:尝试读取流的末尾。 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()中的
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)中的
Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware中的
。 ; StartAngularCliServerAsync> d__3.MoveNext()
-内部异常堆栈跟踪的结尾-Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware .-
。< StartAngularCliServerAsync> d__3.MoveNext()< ---
< ---


解决方案

对我来说,以下问题已得到解决: https://github.com/angular / angular-cli / issues / 10666



此外,您还需要编辑package.json文件,并从一开始就删除--extractCss参数并进行构建属性。
来自:

 脚本:{
ng: ng,
start: ng serve --extract-css,
build: ng build –extract-css,

至:

 脚本:{
ng : ng,
start: ng serve,
build: ng build,


I'm attempting to start an .NET Core 2/Angular 6 SPA. I created an Angular 5 Application using "dotnet new angular" then proceeded to upgrade using this guide from angular.io. Once I finished the upgrade I tried to run the application using "dotnet run" and I get an ugly error page with the error:

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'

Thinking perhaps I missed a step during the upgrade, I tried a second time and got the same error.

Here are the steps I took after creating the app:

npm install -g @angular/cli
npm install @angular/cli
ng update @angular/cli
ng update @angular/core
npm install --save @angular/material @angular/cdk @angular/animations hammerjs 
npm install -g rxjs-tslint
rxjs-5-to-6-migrate -p src/tsconfig.app.json

I'm running Node version 9.4.0 and .Net Core 2.1.200 on Windows 10 (1703) Enterprise.

Any ideas on how to fix this? Here is a full stack trace:

 ---> System.IO.EndOfStreamException: Attempted to read past the end of the stream.
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.<StartAngularCliServerAsync>d__3.MoveNext()
   --- End of inner exception stack trace ---
   at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.<StartAngularCliServerAsync>d__3.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.<>c.<Attach>b__2_0(Task`1 task)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at Microsoft.AspNetCore.SpaServices.Extensions.Util.TaskTimeoutExtensions.<WithTimeout>d__1`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.SpaServices.Extensions.Proxy.SpaProxy.<PerformProxyRequest>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Builder.SpaProxyingExtensions.<>c__DisplayClass2_0.<<UseProxyToSpaDevelopmentServer>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.<Invoke>d__7.MoveNext()
---> (Inner Exception #0) System.AggregateException: 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'

) ---> System.InvalidOperationException: The NPM script 'start' exited without indicating that the Angular CLI was listening for requests. The error output was: Unknown option: '--extractCss'

 ---> System.IO.EndOfStreamException: Attempted to read past the end of the stream.
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.<StartAngularCliServerAsync>d__3.MoveNext()
   --- End of inner exception stack trace ---
   at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.<StartAngularCliServerAsync>d__3.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.<>c.<Attach>b__2_0(Task`1 task)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
---> (Inner Exception #0) System.InvalidOperationException: The NPM script 'start' exited without indicating that the Angular CLI was listening for requests. The error output was: Unknown option: '--extractCss'

 ---> System.IO.EndOfStreamException: Attempted to read past the end of the stream.
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.<StartAngularCliServerAsync>d__3.MoveNext()
   --- End of inner exception stack trace ---
   at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.<StartAngularCliServerAsync>d__3.MoveNext()<---
<---

解决方案

For me this and the followings are solved the issue: https://github.com/angular/angular-cli/issues/10666

And also you need to edit your package.json file and remove the --extractCss parameter from the start and build property. from:

"scripts": {
    "ng": "ng",
    "start": "ng serve --extract-css",
    "build": "ng build --extract-css",

to:

"scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",

这篇关于NPM脚本“开始”退出,但未指示Angular CLI正在侦听请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆