node.js - AWS Elastic Beanstalk : Do I have to deploy my app with full "/node_modules" and "/bower_components" and compiled sass and other dependencies?

标签 node.js git amazon-web-services amazon-elastic-beanstalk

我不明白 AWS Elastic Beanstalk 在 Node.js 应用程序方面的工作方式。 Node.js 开发的最佳实践表明,不必将 /node_modules/bower_components 或其他第三方包推送到版本控制系统(例如 GitHub) ,仅package.json。所有这些 /node_modules 都必须位于 .gitignore 中。然后任何人都可以执行 npm installbower install 并安装所有依赖项。对于 sass 也是如此 - 为生产环境编译它们。

好的,但是 AWS Elastic Beanstalk 怎么样?我如何创建 Node.js 应用程序的源包?我是否必须提交完整的 /node_modules/bower_components 然后用它们制作一个 .zip bundle ?但我的 HEAD 提交没有 /node_modules,因为 /node_modules 位于 .gitignore 中。因此 .zip bundle 中不会存在任何依赖项:

git archive --format=zip HEAD > app.zip

或者,在将 app.zip 部署到 AWS Elastic Beanstalk 后,我是否可以选择安装所有依赖项?

或者,在我上传 app.zip bundle 后,AWS Elastic Beanstalk 会立即在幕后某个地方自行 npm install 吗?

最佳答案

Elastic Beanstalk 在使用 get 部署应用程序时运行一些 npm 命令。我做了一个little experiment几个月前。

简而言之,您可以使用 npm install 部署依赖项,然后使用 npm prestart 构建和编译 sass 等内容。

关于node.js - AWS Elastic Beanstalk : Do I have to deploy my app with full "/node_modules" and "/bower_components" and compiled sass and other dependencies?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33953204/

相关文章:

amazon-web-services - 如何在嵌套服务调用链中实现弹性(重试)

android - TLS - Node.js 服务器到 Android 应用程序

javascript - 如何在 Express 中访问 POST 表单字段

node.js - 无限循环 Kafka Consumer

git - git clone 可以从 http2 中受益吗

amazon-web-services - 将 AWS Lake Formation 与 CloudFormation 结合使用

python - 如何使用 Python 2.7 在 AWS Lambda 中编写 hello world 示例?

javascript - 运行时使用 JavaScript 的 Google API 地理编码错误

git - 如何在 JetBrains IDE 中使用 --no-verify 标志进行提交

node.js - npm install 时发生致命坏对象错误