Luk*_*ger 16 amazon-web-services amazon-elastic-beanstalk
我正在尝试使用 Elastic beanstalk 部署 Node.js API。
我想设置节点命令来启动应用程序。
这是我的 nodecommand.config:
option_settings:
aws:elasticbeanstalk:container:nodejs:
NodeCommand: "npm start"
Run Code Online (Sandbox Code Playgroud)
每当我尝试运行时eb deploy
,都会收到此错误:
2020-05-13 19:03:44 INFO Environment update is starting.
2020-05-13 19:03:48 ERROR "option_settings" in one of the configuration files failed validation. More details to follow.
2020-05-13 19:03:48 ERROR Unknown or duplicate parameter: NodeCommand
2020-05-13 19:03:48 ERROR Failed to deploy application.
ERROR: ServiceError - Failed to deploy application.
Run Code Online (Sandbox Code Playgroud)
Cor*_*eau 46
我刚刚遇到了同样的问题。经过调查,我发现“NodeCommand”是使用自定义命令运行应用程序的传统方式。
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_nodejs.container.html
我删除了“.ebextensions”目录,并在我的源目录中添加了一个名为“Procfile”的文件。
在 Procfile 中,尝试输入以下内容:
web: npm start
Run Code Online (Sandbox Code Playgroud)
在尝试部署之前,请确保在必要时使用这些更改更新您的存储库。
希望这可以帮助!
我使用 Procfile 来部署应用程序
在 Procfile 中
web: npm run deploy
Run Code Online (Sandbox Code Playgroud)
在 package.json 中,添加了新命令 deploy
"scripts": {
"deploy": "npm run build && npm run start"
},
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
6067 次 |
最近记录: |