Reputation: 21
I am creating a new asp.net core project in VS 2019. It's a web app in core v5 with React. I have NodeJS v14 installed. When I run the project once I create it, I get this error:
The npm script 'start' exited without indicating that the create-react-app server was listening for requests
I haven't changed any line of code and this is the result of the scaffolding.
Upvotes: 0
Views: 1309
Reputation: 114
Your problem is probably your "ASPNETCORE_ENVIRONMENT" variable in Development enviroment. If you look your Startup.cs file, you will find this lines:
if (env.IsDevelopment())
{
spa.UseReactDevelopmentServer(npmScript: "start");
}
When you upload that code to a server with the developmen variable, the angular CLI cannot be launched a second time, so it crashes and gives that error message. You can substitute it for:
#if DEBUG
spa.UseReactDevelopmentServer(npmScript: "start");
#endif
I recommend this second option, since if you use the first one, the application will stop working locally.
Upvotes: 1