已尝试几个小时来修复此问题,但无法发出带有此错误的发布请求。起初我使用的是 ng serve 但后来开始使用 npm start 但仍然出现错误。
错误:
[HPM] Error occurred while trying to proxy request /api/books from localhost:4200 to http://localhost:3333 (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)
我的代理文件:
{
"/api/*": {
"target": "https://localhost:4200",
"secure": false,
"changeOrigin": true,
"logLevel": "debug"
}
}
最佳答案
这是 NX Monorepo 的问题吗?如果是,您只是在运行此命令:
ng serve
在终端的新选项卡中,还运行命令:
ng serve api
因为两个服务器都需要启动。
关于javascript - 尝试从本地主机 :4200 to http://localhost:3333 代理请求/api/书籍时出现 Angular HPM 本地主机错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61842243/