gpt4 book ai didi

node.js - 在 AWS ElasticBeanstalk 上部署 - 在启动服务器之前运行自定义 npm 脚本?

转载 作者:太空宇宙 更新时间:2023-11-03 22:07:31 25 4
gpt4 key购买 nike

我一直在尝试将我的 nuxt 通用应用程序部署到 AWS elastic beanstalk 上。我尝试在 package.json 中使用自定义 npm 脚本:

"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate",
"precommit": "npm run lint",
"deploy": "nuxt build && nuxt start"
},

然后在AWS EB配置下,我添加了 Node 命令:npm run deploy

但是,它不起作用。

基本上,我需要告诉 EB 在“npm run start”之前运行“npm run build”

有人可以帮忙吗?

最佳答案

您所描述的问题属于 npm 领域,可以通过使用预启动脚本来解决,如下所示:

"prestart": "nuxt build"

更多详细信息请参见:https://docs.npmjs.com/misc/scripts

关于node.js - 在 AWS ElasticBeanstalk 上部署 - 在启动服务器之前运行自定义 npm 脚本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51457441/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com