Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code: running ASP.NET SPA with Angular 4 and using NodeServices options Launch With Debugging

I have tried to launch in VS Code my SPA project (Angular 4 + ASP.NET) and I am getting errors. This errors are cause by:

 // 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;
            });

This options should enable debugging my javascript/typscript code while it is prerendered on the server. But the problem is that this configuration is deprecated.

Error while running application in the browser

It means that I should use node --inspect instead of node --debug But how can I achieve this in VS Code, or ASP.NET Core project to force that dotnet run command will start appropriate node debugging mode.

like image 889
Michał Ziobro Avatar asked Mar 23 '26 09:03

Michał Ziobro


1 Answers

This issue is caused by change in Node.js between versions 4.x and later. The required changes or modifications to fix this issue are already done for NodeServices package which is compatible with .Net Core 2.0 (Fix is not available for .Net Core 1.0)

So following are the available options

  1. Downgrade to Node 4.x which doesn't exhibit this problem Or

  2. upgrade to ASP.NET Core 2.0 Preview 2, which includes the latest version of NodeServices in which this issue is fixed.

Thanks to Steve for clarifying in below thread https://github.com/aspnet/JavaScriptServices/issues/1084#issuecomment-313083926

like image 189
David Chelliah Avatar answered Mar 25 '26 22:03

David Chelliah



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!