We needed to get one of our Node.js environments is running on AWS Elastic Beanstalk and we use Yarn over NPM as our Node package manager of choice. After spending a ton of time Googling and searching Stack Overflow, we were finally able to identify a solution to reliably disable NPM and use Yarn to install our packages for our EB application.
Instead of going through the same pain we went through, feel free to copy/paste and lift the code below 😎
Add this file to your .ebextensions/
directory to disable npm from installing your node packages upon deployment.
Add this file to your .ebextensions/
directory to install yarn and use it instead of npm to install your node packages upon deployment.
Thanks to the community for support and particularly this Stack Overflow answer.