Search code examples
asp.net-coreiis-7.5angular6

Publishing an Angular 6 app with Asp.Net Core 2.1.1 on IIS


Using Visual Studio 2017 (15.7.5) the application performs normally. However, when publishing to IIS 7.5 I get the following error when I try to access the browser:

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: npm ERR! path C:\Sites\NewPro\Microsum.NewPro.ERP\ERPApp\package.json

npm ERR! code ENOENT

npm ERR! errno -4058

npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open 'C:\Sites\NewPro\Microsum.NewPro.ERP\ERPApp\package.json'

npm ERR! enoent This is related to npm not being able to find a file.

npm ERR! enoent

npm ERR! A complete log of this run can be found in:

npm ERR! C:\Windows\system32\config\systemprofile\AppData\Roaming\npm-cache_logs\2018-08-01T14_50_15_092Z-debug.log

))

System.Threading.Tasks.Task.GetResultCore(bool waitCompletionNotification)

InvalidOperationException: The NPM script 'start' exited without indicating that the Angular CLI was listening for requests. The error output was: npm ERR! path C:\Sites\NewPro\Microsum.NewPro.ERP\ERPApp\package.json

npm ERR! code ENOENT

npm ERR! errno -4058

npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open 'C:\Sites\NewPro\Microsum.NewPro.ERP\ERPApp\package.json'

npm ERR! enoent This is related to npm not being able to find a file.

npm ERR! enoent

npm ERR! A complete log of this run can be found in:

npm ERR! C:\Windows\system32\config\systemprofile\AppData\Roaming\npm-cache_logs\2018-08-01T14_50_15_092Z-debug.log

Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.StartAngularCliServerAsync(string sourcePath, string npmScriptName, ILogger logger)

Stack Query Cookies Headers

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: npm ERR! path C:\Sites\NewPro\Microsum.NewPro.ERP\ERPApp\package.json

npm ERR! code ENOENT npm ERR! errno -4058 npm ERR! syscall open npm ERR! enoent ENOENT: no such file or directory, open 'C:\Sites\NewPro\Microsum.NewPro.ERP\ERPApp\package.json'

npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent

npm ERR! A complete log of this run can be found in:

npm ERR! C:\Windows\system32\config\systemprofile\AppData\Roaming\npm-cache_logs\2018-08-01T14_50_15_092Z-debug.log

))

System.Threading.Tasks.Task.GetResultCore(bool waitCompletionNotification)

Microsoft.AspNetCore.SpaServices.Extensions.Util.TaskTimeoutExtensions.WithTimeout(Task task, TimeSpan timeoutDelay, string message)

Microsoft.AspNetCore.SpaServices.Extensions.Proxy.SpaProxy.PerformProxyRequest(HttpContext context, HttpClient httpClient, Task baseUriTask, CancellationToken applicationStoppingToken, bool proxy404s)

Microsoft.AspNetCore.Builder.SpaProxyingExtensions+<>c__DisplayClass2_0+<b__0>d.MoveNext()

Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)

Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)

Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Show raw exception details

InvalidOperationException: The NPM script 'start' exited without indicating that the Angular CLI was listening for requests. The error output was: npm ERR! path C:\Sites\NewPro\Microsum.NewPro.ERP\ERPApp\package.json

npm ERR! code ENOENT npm ERR! errno -4058 npm ERR! syscall open npm ERR! enoent ENOENT: no such file or directory, open 'C:\Sites\NewPro\Microsum.NewPro.ERP\ERPApp\package.json'

npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent

npm ERR! A complete log of this run can be found in:

npm ERR! C:\Windows\system32\config\systemprofile\AppData\Roaming\npm-cache_logs\2018-08-01T14_50_15_092Z-debug.log

Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.StartAngularCliServerAsync(string sourcePath, string npmScriptName, ILogger logger)

Show raw exception details

System.InvalidOperationException: The NPM script 'start' exited without indicating that the Angular CLI was listening for requests. The error output was: npm ERR! path C:\Sites\NewPro\Microsum.NewPro.ERP\ERPApp\package.json

npm ERR! code ENOENT

npm ERR! errno -4058

npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open 'C:\Sites\NewPro\Microsum.NewPro.ERP\ERPApp\package.json'

npm ERR! enoent This is related to npm not being able to find a file.

npm ERR! enoent

npm ERR! A complete log of this run can be found in:

npm ERR! C:\Windows\system32\config\systemprofile\AppData\Roaming\npm-cache_logs\2018-08-01T14_50_15_092Z-debug.log

---> System.IO.EndOfStreamException: Attempted to read past the end of the stream.

at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.StartAngularCliServerAsync(String sourcePath, String npmScriptName, ILogger logger)

--- End of inner exception stack trace ---

at Microsoft.AspNetCore.SpaServices.AngularCli.AngularCliMiddleware.StartAngularCliServerAsync(String sourcePath, String npmScriptName, ILogger logger)

The log generated is as follows:

info it worked if it ends with ok

verbose cli [ 'D:\Programas\nodejs\node.exe',

verbose cli 'D:\Programas\nodejs\node_modules\npm\bin\npm-cli.js',

verbose cli 'run',

verbose cli 'start',

verbose cli '--',

verbose cli '--port',

verbose cli '52476' ]

info using [email protected]

info using [email protected]

verbose stack Error: ENOENT: no such file or directory, open 'C:\Sites\NewPro\Microsum.NewPro.ERP\ERPApp\package.json'

verbose cwd C:\Sites\NewPro\Microsum.NewPro.ERP\ERPApp

verbose Windows_NT 6.1.7601

verbose argv "D:\Programas\nodejs\node.exe" "D:\Programas\nodejs\node_modules\npm\bin\npm-cli.js" "run" "start" "--" "--port" "52476"

verbose node v8.11.3

verbose npm v5.6.0

error path C:\Sites\NewPro\Microsum.NewPro.ERP\ERPApp\package.json

error code ENOENT

error errno -4058

error syscall open

error enoent ENOENT: no such file or directory, open 'C:\Sites\NewPro\Microsum.NewPro.ERP\ERPApp\package.json'

error enoent This is related to npm not being able to find a file.

verbose exit [ -4058, true ]

Any suggestions are very welcome.


Solution

  • I was able to resolve by ignoring the standard visual template of visual studio and creating an AspNet Web Application project and later creating the angular application.

    I put the project code in github to be used by those who have the same problems.

    I generated a detailed step-by-step with prints for anyone who wants to build the project manually: