在部署Nodejs应用程序时,AWS Beanstalk如何使用NPM? [英] How does AWS Beanstalk use NPM when deploying a Nodejs App?
问题描述
我对AWS Beanstalk部署的整体工作流程感到好奇。我假设它在某些时候运行npm以获得在服务器上安装的软件包。但我只是想知道AWS Beanstalk是否使用'npm install --production'的最新命令来安装软件包。目前我有一个如下所示的packages.json文件,如果可能的话,我想保证只安装依赖项,而不是devDependencies。
I'm curious about the overall workflow of an AWS Beanstalk deployment. I'm assuming it runs npm at some point to get the packages installed on the server(s). But I was just wondering if AWS Beanstalk uses the latest command of 'npm install --production' to install packages. Currently I have a packages.json file as shown below and would like to insure if possible that only the dependencies are being installed and not the devDependencies.
"dependencies": {
"express": "3.4.4",
"jade": "*",
"restify": "~2.6.0",
"assert": "~1.0.0",
"orchestrate": "0.0.2",
"chance": "~0.5.3"
},
"devDependencies": {
"mocha": "~1.15.1"
}
推荐答案
目前Elastic Beanstalk环境运行 npm install
而没有 - production
标志。在导出开发人员提供的任何env自定义项(即环境选项设置)之前,会在 /opt/elasticbeanstalk/containerfiles/ebnode.py
上的实例上发生这种情况,这意味着设置EB环境中的 NODE_ENV = production
配置也不会阻止处理devDependencies。
Currently the Elastic Beanstalk environment runs npm install
without the --production
flag. This happens on the instance at /opt/elasticbeanstalk/containerfiles/ebnode.py
before any env customizations supplied by the developer (i.e., environment option settings) are exported, which means setting NODE_ENV=production
in the EB Environment's configuration also does not prevent devDependencies from being processed.
这篇关于在部署Nodejs应用程序时,AWS Beanstalk如何使用NPM?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!