我正在开发一个部署在 Heroku 上的小组项目,但现在我需要对其进行进一步的工作,并尝试让它再次在本地运行。这是一个使用 MongoDB 的 React 应用程序。我克隆了存储库,并在根文件夹和客户端文件夹中安装了 npm。当我输入 npm run dev 时,页面出现,但功能不起作用。当我尝试登录、注册或提交照片时出现错误:
\n\n从航站楼:
\n\n[1] Proxy error: Could not proxy request /api/account/signin from localhost:3000 to http://localhost:3001/.\n[1] See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNREFUSED).\nRun Code Online (Sandbox Code Playgroud)\n\n从控制台:
\n\nPOST http://localhost:3000/api/account/signin 500 (Internal Server Error)\nUncaught (in promise) Error: Request failed with status code 500\n at createError (createError.js:16)\n at settle (settle.js:18)\n at XMLHttpRequest.handleLoad (xhr.js:77)\nRun Code Online (Sandbox Code Playgroud)\n\n我查看了错误日志,似乎服务器拒绝建立连接。我不知道问题出在哪里。最让我困惑的是,我的另一位团队成员也克隆了该存储库,并声称一切都对他有用。它在 Heroku 上部署时也能正常运行。我的计算机上是否存在可能导致问题的特定设置?我的防火墙已关闭。如果是代码问题,以下是其中的一些问题:
\n\n服务器.js:
\n\nconst express = require(\'express\');\nconst app = express();\nconst mongoose = require(\'mongoose\');\nconst bodyParser = require(\'body-parser\'); …Run Code Online (Sandbox Code Playgroud)