There's some bug in npm v7+, it uses a lot of memory and is slower when "node_modules" doesn't exist yet. See this answer: https://github.com/npm/cli/issues/3208#issuecomment-1002990902
The solution is to create node_modules in a prebuild hook:
and install manually in predeploy hook (elastic beanstalk will bail out of installing if node_modules already exists) predeploy:
npm install --omit=dev
Note, we need to split in 2 steps, because elasticbeanstalk installs the target node version in the middle and run
npm install immediately.
I know it's too late, but anyway.
I had the same problem: the app was successfully deployed to elastic beanstalk with node v14 but failed with no adequate error while deploying to node v16.
The problem was the lack of memory. For some reason, npm v8 (which is installed with node v16) uses more memory while packages installing than npm v6 (which is installed with node v14). I haven't investigated the reason yet.
Changing the tier from 1GB RAM to 2GB RAM solved the issue.
The beanstalk node script really need to be updated to use --omit=dev
- Accepted Answerasked 8 months ago
- Accepted Answerasked 10 months ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 7 months ago
- How do I terminate or rebuild my Elastic Beanstalk environment when the AWSEBSecurityGroup fails to delete?AWS OFFICIALUpdated 3 months ago