permissions error during yarn install on elastic-beanstalk

1.1k views Asked by At

We are using elastic-beanstalk as our server. We are using webpacker with rails to compile and bundle a react app. When deploying the logs, we get the following

yarn install v1.0.2
[1/4] Resolving packages...
Webpacker is installed  
Using /var/app/ondeck/config/webpacker.yml file for setting up webpack paths
Compiling…
Compilation failed:

./bin/webpack:26:in `exec': No such file or directory - /var/app/ondeck/node_modules/.bin/webpack (Errno::ENOENT)
from ./bin/webpack:26:in `block in <main>'
from ./bin/webpack:25:in `chdir'
from ./bin/webpack:25:in `<main>'
(Executor::NonZeroExitStatus)

It appears there is an error installing yarn packages as it is not going to step 2 or 4.

When I ssh into the server, go to the ondeck directory, which has the newest code I believe and then I run yarn install, I get:

error Could not write file "/var/app/ondeck/yarn-error.log": "EACCES: 
permission denied, open '/var/app/ondeck/yarn-error.log'"
error An unexpected error occurred: "EACCES: permission denied, mkdir 
'/var/app/ondeck/node_modules'".

when I use sudo yarn install it works and when I update the permissions with sudo chmod -R 777 /var/app, it works. So I tried and add the chmod command to a .ebextensions config file but I am having no luck.

What is odd is that we are using 2 servers on elastic-beanstalk and the first one deploys correctly using the same code and config files. Then this server doesn't deploy correctly so I'm not understanding how the permissions could be different between the servers unless someone manually changed them.

I have created an issue in webpacker here: https://github.com/rails/webpacker/issues/810

0

There are 0 answers