VS Code: Starting ASP.NET SPA with Angular 4 and Using NodeServices Options Starting with Debug

I tried to run my SPA project (Angular 4 + ASP.NET) in VS Code and I am getting errors. These errors cause:

 // Add JavaScript services.
            services.AddNodeServices(options => {
                // https://github.com/aspnet/JavaScriptServices/tree/dev/src/Microsoft.AspNetCore.SpaServices#debugging-your-javascripttypescript-code-when-it-runs-on-the-server
                options.LaunchWithDebugging = true; 
                options.DebuggingPort = 9229;
            });

      

These options should enable debugging of javascript / typscript code while previewing it on the server. But the problem is that this configuration is outdated.

Error while launching the application in the browser

This means that I should use node --inspect

instead of node --debug

But how can I achieve this in VS Code or in an ASP.NET Core project to force the command dotnet run

to start the appropriate node debug mode.

+3


source to share


1 answer


This issue is caused by a change in Node.js between 4.x and later versions. Necessary changes or modifications to fix this issue have already been made for the NodeServices package, which is compatible with .Net Core 2.0 (no fix available for .Net Core 1.0)

So the following options are available



  • Switching to Node 4.x which doesn't detect this issue. Or

  • Upgrade to ASP.NET Core 2.0 Preview 2, which includes the latest NodeServices that fixes this issue.

Thanks to Steve for clarification in the downstream https://github.com/aspnet/JavaScriptServices/issues/1084#issuecomment-313083926

+1


source







All Articles