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 wo
In the new versions of Elastic Beanstalk Node's stacks, the configuration has changed, as pointed by @etreworgy's comment.
You can check the current behavior, by running inside an EC2 instance:
cat /opt/elasticbeanstalk/containerfiles/ebnode.py | grep -A 5 PRODUCTION
It returns, as of today:
if 'NPM_USE_PRODUCTION' not in npm_env:
npm_env['NPM_USE_PRODUCTION'] = 'true'
if npm_env['NPM_USE_PRODUCTION'] == 'true':
print 'Running npm with --production flag'
check_call([npm_path, '--production', 'install'], cwd=app_path, env=npm_env)
check_call([npm_path, '--production', 'rebuild'], cwd=app_path, env=npm_env)
else:
print 'Running npm without --production flag'
So, currently, it uses the npm install --production
by default.
For those ones that want to disable it (as I was when I went to this answer), you have to create a anything.config inside an .ebextensions
folder at your project's root folder (where anything means really anything; node, npm, whatever you want), with the content:
option_settings:
- namespace: aws:elasticbeanstalk:application:environment
option_name: NPM_USE_PRODUCTION
value: false