【发布时间】:2018-09-06 03:54:35
【问题描述】:
我正在尝试将 create-react-app 部署到弹性 beantalk。我的部署不断超时
ERROR: TimeoutError - The EB CLI timed out after 10 minute(s). The operation might still be running. To keep viewing events, run 'eb events -f'. To set timeout duration, use '--timeout MINUTES'.
我已经尝试了很多不同的方法来让它工作。这是我的config.yml 文件
branch-defaults:
dev:
environment: uu-pilot
group_suffix: null
environment-defaults:
uu-pilot:
branch: null
repository: null
global:
application_name: uu-pilot
branch: null
default_ec2_keyname: null
default_platform: Node.js
default_region: ca-central-1
include_git_submodules: true
instance_profile: null
platform_name: null
platform_version: null
profile: eb-cli
repository: null
sc: git
workspace_type: Application
我的nodecommand.config 在.ebextensions 文件夹中:
option_settings:
aws:elasticbeanstalk:container:nodejs:
NodeCommand: "npm start"
^^ 我也试过把node命令改成react-scripts build和react-scripts start
所有依赖项都在 dependencies 下,而不是 package.json 中的 devDependencies,这是我的脚本
"scripts": {
"prestart": "react-scripts build",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"start:prod": "react-scripts start"
}
我没有收到任何特定的错误消息,并且由于该操作也超时,因此无法查看确切的日志。我还添加了这个,以防它只是一个超时的事情:
option_settings:
- namespace: aws:elasticbeanstalk:command
option_name: Timeout
value: 1800
最后,我部署了一个基本的节点应用程序,看看它是否可以工作并且确实有效,所以问题在于 create-react-app 节点服务器为构建文件夹提供服务的方式。
赞赏任何方向。
【问题讨论】:
-
请问您为什么要尝试这个?为什么不轻易
build你的 react 应用并将其“部署”到 S3 并将其作为静态网站提供服务? -
我被告知要这样做,有什么我可以做的吗?
-
对不起,但这根本没有意义...请按照前面描述的方式:“构建您的反应应用程序并将其“部署”到 S3 并将其作为静态网站提供服务”
-
是的,这样做可以...通过 s3 存储桶
-
服务器只能在开发时使用...... GitHub README 中的一小段引述:“当你准备好部署到生产环境时,使用 npm run build 创建一个缩小的包”跨度>
标签: node.js amazon-web-services deployment amazon-elastic-beanstalk create-react-app