0

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.

5
  • Does this answer your question? The NPM script 'start' exited without indicating that the create-react-app server was listening for requests Commented May 31, 2021 at 5:38
  • No. The new project scaffolding already has that if condition in place and it's still not working. Plus, it's running in development for me and not working. Commented May 31, 2021 at 6:25
  • have you try "npm start" in cmd? Commented May 31, 2021 at 7:57
  • Does it show the error output? Commented Jun 1, 2021 at 7:46
  • @NormanW - Gonzalo's answer seems to be correct. Worked for me after struggling for weeks with this Commented Apr 5, 2022 at 19:41

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.