Open curtisnn opened 6 years ago
@curtisnn Thanks for sharing. Since I always use docker so I havent seen this issue before. It's good to know. I have added this to FAQ in wiki page
For anyone else running in to this permission issue, I solved this on Elastic Beanstalk with this solution script mentioned above or with more detail at https://github.com/ember-fastboot/fastboot-aws/issues/4#issuecomment-272497834 and nothing else – didn't need the postscripts. Didn't run into the jpjs crash described above.
The NPMRC trick from https://stackoverflow.com/questions/46001516/beanstalk-node-js-deployment-node-gyp-fails-due-to-permission-denied/46001517#46001517 didn't solve the permission trick on EB for me, but didn't try it separate from the Elastic Beanstalk script in the paragraph above so can't be 100% sure that it had no effect.
Dockerization didn't solve the permission issue for me.
Not sure where to put this, as it isn't an issue, just some lessons learned of what I did to get hummus-recipe to work within a NodeJS instance on AWS elastic beanstalk. Hopefully it saves someone some time. There may be advice for handling it better, which I would appreciate.
To install the package I simply ran
npm install --save hummus-recipe
When I then deployed to amazon AWS, I got an error when it was trying to install npm that looked like this: (visible in
var/log/eb-activity.log
)It seems that node-pre-gyp is run as the default user rather than root so didn't have the ability to mkdir. See:
To provide permissions I added a .ebextensions config file: 01_npmrc.config (make sure indentation is correct for YAML file)
When I submitted this change, it was able to install npm but crashed my server with the error here:
AWS kept trying to restart node, so this message continually popped up. (as seen in
/var/log/nodejs/nodejs.log
. I checked the node_modules folder on the ec2 instance and sure enough the jpgjs folder was missing. This package is required by the utif library used by hummus which is used by hummus-recipe as shown in the package-lock.json after installing hummus-recipeI am uncertain as to why it didn't install that package? However, to solve that issue, I downloaded the jpgjs folder from https://github.com/makr28/jpgjs and added it to a libs folder in my own repository. Then I added this postinstall script (within the scripts section of package.json) to copy the folder to node_modules.
Perhaps not so elegant a solution ... but alas, it deploys to AWS elastic beanstalk without any issues! Yay!