The way that we fixed this issue is by using an .ebextensions file to overwrite the 50npm.sh file. Just create the following as an .ebextensions file and add it to the base of your project. When the project is deployed on Elastic Beanstalk, it will overwrite the default file and run npm install with the –unsafe-perm flag.