Description
VS2019 version: 16.11.1
Node version: 14.17.5
NPM version: 6.14.14
Service Fabric SDK: 5.1.321.9590 (latest at time of writing)
Steps to re-create the issue:
Launch Visual Studio 2019 and click "Create New Project"
Select "Service Fabric Application" and click "Next"
On the next screen select .NET Framework 4.8 and click the "Create" button
On the next screen select "Stateless ASP.NET Core" and click the "Create" button.
A popup will appear asking which type of ASP.NET core app you'd like to create. Select "ASP.NET Core with React.js".
Click the "Create" button.
[If you've installed the service fabric SDK for the first time, find the icon for it in the system tray, right click on it and setup a 1 node cluster - takes a few minutes to become ready.].
After the project has been created and your local service fabric cluster has started, click the "Start" button in Visual Studio (or press F5) to launch the project.
After a lengthy pause, a browser window will open showing the following error:
The text of this error is as follows:
`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 create-react-app server was listening for requests. The error output was: Error: EPERM: operation not permitted, mkdir 'C:\WINDOWS\system32\config\systemprofile\AppData\Roaming\npm'
Error: EPERM: operation not permitted, mkdir 'C:\WINDOWS\system32\config\systemprofile\AppData\Roaming\npm'
))
System.Threading.Tasks.Task.GetResultCore(bool waitCompletionNotification)
InvalidOperationException: The npm script 'start' exited without indicating that the create-react-app server was listening for requests. The error output was: Error: EPERM: operation not permitted, mkdir 'C:\WINDOWS\system32\config\systemprofile\AppData\Roaming\npm'
Error: EPERM: operation not permitted, mkdir 'C:\WINDOWS\system32\config\systemprofile\AppData\Roaming\npm'
Microsoft.AspNetCore.SpaServices.ReactDevelopmentServer.ReactDevelopmentServerMiddleware.StartCreateReactAppServerAsync(string sourcePath, string scriptName, string pkgManagerCommand, int portNumber, ILogger logger, DiagnosticSource diagnosticSource, CancellationToken applicationStoppingToken)
Stack Query Cookies Headers Routing
AggregateException: One or more errors occurred. (One or more errors occurred. (The npm script 'start' exited without indicating that the create-react-app server was listening for requests. The error output was: Error: EPERM: operation not permitted, mkdir 'C:\WINDOWS\system32\config\systemprofile\AppData\Roaming\npm' Error: EPERM: operation not permitted, mkdir 'C:\WINDOWS\system32\config\systemprofile\AppData\Roaming\npm' ))
System.Threading.Tasks.Task.GetResultCore(bool waitCompletionNotification)
System.Threading.Tasks.Task.get_Result()
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.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Show raw exception details
InvalidOperationException: The npm script 'start' exited without indicating that the create-react-app server was listening for requests. The error output was: Error: EPERM: operation not permitted, mkdir 'C:\WINDOWS\system32\config\systemprofile\AppData\Roaming\npm' Error: EPERM: operation not permitted, mkdir 'C:\WINDOWS\system32\config\systemprofile\AppData\Roaming\npm'
Microsoft.AspNetCore.SpaServices.ReactDevelopmentServer.ReactDevelopmentServerMiddleware.StartCreateReactAppServerAsync(string sourcePath, string scriptName, string pkgManagerCommand, int portNumber, ILogger logger, DiagnosticSource diagnosticSource, CancellationToken applicationStoppingToken)`
I've verified this problem exists on two different computers. We see the same behaviour if you select "ASP.NET Core with React.js and Redux" in the final step of the project creation.