Hi there I am using AWS Beanstalk to deploy my Express app for the first time right and when I try to upload my Express app I get an error saying this:
[ERROR] An error occurred during execution of command [app-deploy] - [Use NPM to install dependencies]. Stop running the command. Error: Command /bin/sh -c npm --production install failed with error exit status 1. Stderr:npm ERR! code 1
npm ERR! path /var/app/staging/node_modules/sharp
npm ERR! command failed
npm ERR! command sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
npm ERR! sharp: Are you trying to install as a root or sudo user? Try again with the --unsafe-perm flag
npm ERR! sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies
npm ERR! sharp: Installation error: EACCES: permission denied, mkdir '/root/.npm'
I know that the solution was to add .npmrc with code unsafe-perm=true but this didnt fix the issue. It seems that the issue is on the user that is use to perform the installation of dependencies and node-gyp may need root privilegies.
Any idea how to achieve this? It failes as soon as it tries to install the 'sharp' library