node.js - 不同端口上的 NodeJS 和 React 并发服务器
问题描述
故事:最近,我们开始使用'create-react-app'
. 当时它在我们的开发机器上运行良好。
一段时间后,我们开始使用 express 开发 NodeJS API,然后将其连接到我们的 React 前端。在我们的开发机器上,一切仍然运行良好。
问题:由于我们现在完成了开发,并希望将应用程序托管在第 3 方服务器(A2Hosting)上;我们在同时启动服务器和 React 应用程序时遇到问题。
如果我们单独启动服务器,它正在工作并且我们能够调用 api。如果我们单独启动 React 应用程序,我们仍然会得到理想的结果。但是如果我们尝试同时运行,问题仍然存在。下面是我们尝试同时运行服务器和客户端时的错误报告:
$ concurrently --kill-others-on-fail "yarn server" "yarn client"
[0] node[3989326]: pthread_create: Resource temporarily unavailable
[1] node[3989327]: pthread_create: Resource temporarily unavailable
[0] yarn server exited with code SIGABRT
--> Sending SIGTERM to other processes..
[1] yarn client exited with code 1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
解决方案
推荐阅读
- python-3.x - 如何用新的 fs.HadoopFileSystem 替换旧的传统 hdfs 连接器?
- python - 熊猫数据框的元素乘法
- python - 用数据框中另一行的值替换一行的值
- c# - EF - 在对象属性的 IEnumerable 的 LINQ 方法中使用多个 WHERE 子句
- java - 对 REST 服务(Spring Boot 和 Java)的多个请求是否会在映射时创建一个类的新对象?
- php - aws s3 createBucket 函数始终返回 S3 BucketAlreadyExists
- c# - 从nuget加载时如何看不到以下错误?
- python - DPC_Watchdog_Violation 当我尝试运行我的代码时
- python - 如何在 Python 函数中矢量化耦合 ODE 系统?
- api - DDD 请求和活动跟踪