当我运行基于.NET Core 3.1的项目时,我在命令提示符下收到此错误,该项目也使用了react
fail: Microsoft.AspNetCore.SpaServices[0]
(node:15004) [DEP_WEBPACK_DEV_SERVER_ON_AFTER_SETUP_MIDDLEWARE] DeprecationWarning: 'onAfterSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.
fail: Microsoft.AspNetCore.SpaServices[0]
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:15004) [DEP_WEBPACK_DEV_SERVER_ON_BEFORE_SETUP_MIDDLEWARE] DeprecationWarning: 'onBeforeSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.
warn: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserRefreshMiddleware[4]
Unable to configure browser refresh script injection on the response. This may have been caused by the response's Content-Encoding: 'gzip'. Consider disabling response compression.
我已经搜索并找到了几个答案,有些人说在我的中间件中添加setUpMiddlewaresspa.UseReactDevelopmentServer(npmScript: "start" , setUpMiddleware => {});
但这是不可能的,因为这个方法没有这样的重载。
我已经尝试通过更新NuGet包到最大兼容版本
1条答案
按热度按时间vqlkdk9b1#
我们可以通过使用以下代码来修复这个问题,更多细节,我们可以检查github问题。