本地主机的SPA服务器无法工作,找不到本地主机。

6
我有一个使用.NET作为后端的React.js项目。我更换了电脑,从git上拉取了文件,本来期望一切能够正常运行。但是现在我却无法启动本地服务器,出现以下错误信息:
'SKGVT.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.1\System.Net.WebSockets.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'SKGVT.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.1\System.Threading.Tasks.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Microsoft.AspNetCore.SpaProxy.SpaProxyLaunchManager: Error: Couldn't start the SPA development server with command 'npm start'.
Microsoft.AspNetCore.SpaProxy.SpaProxyLaunchManager: Information: No SPA development server running at https://localhost:44449 found.
The thread 0x6108 has exited with code 0 (0x0). ```

It seems like its a fault with the localhost URL, but I cant figure out where I change this.

你安装了npm吗? - klekmek
是的,NPM已安装。 - Maffe
我猜测NG被配置为http,而SpaProxy试图加载https。 - Zachary Scott
1个回答

2

我不确定您是否解决了这个问题,但我也遇到了这个问题。 对我来说,问题是我的setupProxy.js期望我使用SSL。

我通过在setupProxy.js中注释掉目标并将其替换为http://localhost:PROXYPORTHERE来“修复”它。

希望对某人有所帮助 :)


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接