Elastic beanstalk runs npm install
with a system user that has no homedir. During the npm install step, it's expecting a $HOME
env variable for the npm cache (which doesn't exist). add this file to your project's .ebextensions
directory to have it use root's homedir as a temporary path.
This workaround was provided by AWS support, but it doesn't appear to be documented anywhere. Determining root cause on this was a massive pain in the ass. Sharing this so others don't need to feel the pain.