You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
> [email protected] install /tmp/deployment/application/node_modules/hummus
> node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v57 ABI, glibc) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/tmp/deployment/application/node_modules/hummus/binding'
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/tmp/deployment/application/node_modules/hummus/build'
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)
files:
# This is the npm user config file path.
"/tmp/.npmrc":
mode: "000755"
owner: root
group: root
content: |
# Force npm to run node-gyp also as root, preventing permission denied errors
unsafe-perm=true
When I submitted this change, it was able to install npm but crashed my server with the error here:
stack:
[ 'Error: Cannot find module \'jpgjs\'',
' at Function.Module._resolveFilename (module.js:513:15)',
' at Function.Module._load (module.js:463:25)',
' at Module.require (module.js:556:17)',
' at require (internal/module.js:11:18)',
' at /var/app/current/node_modules/utif/UTIF.js:10:74',
' at Object.<anonymous> (/var/app/current/node_modules/utif/UTIF.js:911:3)',
' at Module._compile (module.js:612:30)',
' at Object.Module._extensions..js (module.js:623:10)',
' at Module.load (module.js:531:32)',
' at tryModuleLoad (module.js:494:12)',
' at Function.Module._load (module.js:486:3)',
' at Module.require (module.js:556:17)',
' at require (internal/module.js:11:18)',
' at Object.<anonymous> (/var/app/current/node_modules/jimp/dist/utils/image-bitmap.js:22:36)',
' at Module._compile (module.js:612:30)',
' at Object.Module._extensions..js (module.js:623:10)' ] }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
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-recipe
I 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.
"postinstall": "cp -R libs/jpgjs node_modules"
Perhaps not so elegant a solution ... but alas, it deploys to AWS elastic beanstalk without any issues! Yay!
The text was updated successfully, but these errors were encountered:
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 ember-fastboot/fastboot-aws#4 (comment) and nothing else – didn't need the postscripts. Didn't run into the jpjs crash described above.
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!
The text was updated successfully, but these errors were encountered: