The location '/__webpack_hmr' doesn't match any route configured in react-router. #916

Closed
opened 2025-08-09 17:18:10 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @anunaykumar on 3/22/2017

Fresh React with Redux template setup is throwing "location '/__webpack_hmr' doesn't match any route configured in react-router" error when the server is started using dotnet run

Repro steps

  1. npm install -g yo generator-aspnetcore-spa

  2. yo aspnetcore-spa (and install version 0.9.0 of the React with Redux template)

  3. Open folder in VS Code

  4. In the terminal execute following
    set ASPNETCORE_ENVIRONMENT=Development
    dotnet run

  5. navigate to http://localhost:5000/. Observe following error is thrown.

info: Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewResultExecutor[1]
      Executing ViewResult, running view at path /Views/Home/Index.cshtml.
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
      Executed action WebApplicationBasic.Controllers.HomeController.Index (AdminPortal) in 14.4989ms
fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[0]
      An unhandled exception has occurred: Call to Node module failed with error: Error: The location '/__webpack_hmr' doesn't match any route configured in react-router.
    at V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\main-server.js:314:23
    at V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\vendor.js:51885:5
    at V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\vendor.js:20811:11
    at next (V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\vendor.js:20588:7)
    at loopAsync (V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\vendor.js:20592:3)
    at matchRoutes (V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\vendor.js:52148:29)
    at Object.match (V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\vendor.js:20805:33)
    at match (V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\vendor.js:51884:21)
    at V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\main-server.js:303:83
    at V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\main-server.js:300:12
System.Exception: Call to Node module failed with error: Error: The location '/__webpack_hmr' doesn't match any route configured in react-router.
    at V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\main-server.js:314:23
    at V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\vendor.js:51885:5
    at V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\vendor.js:20811:11
    at next (V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\vendor.js:20588:7)
    at loopAsync (V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\vendor.js:20592:3)
    at matchRoutes (V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\vendor.js:52148:29)
    at Object.match (V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\vendor.js:20805:33)
    at match (V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\vendor.js:51884:21)
    at V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\main-server.js:303:83
    at V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\main-server.js:300:12
   at Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance.<InvokeExportAsync>d__7`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance.<InvokeExportAsync>d__14`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.<InvokeExportWithPossibleRetryAsync>d__10`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.SpaServices.Prerendering.PrerenderTagHelper.<ProcessAsync>d__33.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner.<RunAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at AspNetCore._Views_Home_Index_cshtml.<ExecuteAsync>d__31.MoveNext() in /Views/Home/Index.cshtml:line 2
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.<RenderPageAsync>d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.<RenderAsync>d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.<ExecuteAsync>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Mvc.ViewResult.<ExecuteResultAsync>d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeResultAsync>d__30.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextResultFilterAsync>d__28.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ResultExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextResourceFilter>d__22.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ResourceExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeAsync>d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>d__6.MoveNext()
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]
      Executing action method WebApplicationBasic.Controllers.HomeController.Error (AdminPortal) with arguments ((null)) - ModelState is Valid
info: Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewResultExecutor[1]
      Executing ViewResult, running view at path /Views/Shared/Error.cshtml.

  1. If I run the project on IISExpress using VS2017, webpack hmr works fine
Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request starting HTTP/1.1 GET http://localhost:62481/__webpack_hmr  
Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request starting HTTP/1.1 GET http://localhost:62481/favicon.ico  
Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware:Information: Sending file. Request path: '/favicon.ico'. Physical path: 'V:\Code\MyTestProjects\AdminPortal4\wwwroot\favicon.ico'

Thanks
Anunay

*Originally created by @anunaykumar on 3/22/2017* Fresh _React with Redux_ template setup is throwing "location '/__webpack_hmr' doesn't match any route configured in react-router" error when the server is started using dotnet run Repro steps 1) npm install -g yo generator-aspnetcore-spa 2) yo aspnetcore-spa (and install version 0.9.0 of the React with Redux template) 3) Open folder in VS Code 4) In the terminal execute following set ASPNETCORE_ENVIRONMENT=Development dotnet run 5) navigate to http://localhost:5000/. Observe following error is thrown. ``` info: Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewResultExecutor[1] Executing ViewResult, running view at path /Views/Home/Index.cshtml. info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2] Executed action WebApplicationBasic.Controllers.HomeController.Index (AdminPortal) in 14.4989ms fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[0] An unhandled exception has occurred: Call to Node module failed with error: Error: The location '/__webpack_hmr' doesn't match any route configured in react-router. at V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\main-server.js:314:23 at V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\vendor.js:51885:5 at V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\vendor.js:20811:11 at next (V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\vendor.js:20588:7) at loopAsync (V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\vendor.js:20592:3) at matchRoutes (V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\vendor.js:52148:29) at Object.match (V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\vendor.js:20805:33) at match (V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\vendor.js:51884:21) at V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\main-server.js:303:83 at V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\main-server.js:300:12 System.Exception: Call to Node module failed with error: Error: The location '/__webpack_hmr' doesn't match any route configured in react-router. at V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\main-server.js:314:23 at V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\vendor.js:51885:5 at V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\vendor.js:20811:11 at next (V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\vendor.js:20588:7) at loopAsync (V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\vendor.js:20592:3) at matchRoutes (V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\vendor.js:52148:29) at Object.match (V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\vendor.js:20805:33) at match (V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\vendor.js:51884:21) at V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\main-server.js:303:83 at V:\Code\MyTestProjects\AdminPortal4\ClientApp\dist\main-server.js:300:12 at Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance.<InvokeExportAsync>d__7`1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance.<InvokeExportAsync>d__14`1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.<InvokeExportWithPossibleRetryAsync>d__10`1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.SpaServices.Prerendering.PrerenderTagHelper.<ProcessAsync>d__33.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner.<RunAsync>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at AspNetCore._Views_Home_Index_cshtml.<ExecuteAsync>d__31.MoveNext() in /Views/Home/Index.cshtml:line 2 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Razor.RazorView.<RenderPageAsync>d__14.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Razor.RazorView.<RenderAsync>d__13.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.<ExecuteAsync>d__18.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.ViewResult.<ExecuteResultAsync>d__26.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeResultAsync>d__30.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextResultFilterAsync>d__28.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ResultExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextResourceFilter>d__22.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ResourceExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeAsync>d__20.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>d__6.MoveNext() info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1] Executing action method WebApplicationBasic.Controllers.HomeController.Error (AdminPortal) with arguments ((null)) - ModelState is Valid info: Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ViewResultExecutor[1] Executing ViewResult, running view at path /Views/Shared/Error.cshtml. ``` 6) If I run the project on IISExpress using VS2017, webpack hmr works fine ``` Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request starting HTTP/1.1 GET http://localhost:62481/__webpack_hmr Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request starting HTTP/1.1 GET http://localhost:62481/favicon.ico Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware:Information: Sending file. Request path: '/favicon.ico'. Physical path: 'V:\Code\MyTestProjects\AdminPortal4\wwwroot\favicon.ico' ``` Thanks Anunay
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#916
No description provided.