Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby on Rails - Yarn directory location (as it is currently not writable)

UPDATE 23/11/2018 Currently, I've done

yarn config set cache-folder /usr/local/Caches/yarn

And once I run yarn install --check-files, I get the error:

error An unexpected error occurred: "EACCES: permission denied, mkdir '/usr/local/Caches'".

From this, I tried to then do chmod -R 755 /usr/local/Caches/yarn

And I get chmod: cannot access '/usr/local/Caches/yarn': No such file or directory


UPDATE 23/11/2018

Also, I've done mkdir -p ~/home/james/.cache/yarn Then I've done chmod -R 755 ~/home/james/.cache/yarn

Then I obtain the error:

error An unexpected error occurred: "EACCES: permission denied, mkdir '/usr/local/Caches'".

I've done: chmod -R 755 /usr/local/Caches

And then obtained: chmod: cannot access '/usr/local/Caches': No such file or directory

So, the methods I've done so far, have just not solved my issue.


I'm obtaining this error when I am trying to "fix" my yarn gem installation, and also installing webpacker.

"warning Skipping preferred cache folder "/home/james/.cache/yarn" because it is not writable."

I understand I need to change the directory permissions using chmod.

However, when I try and do that, using:

chmod -R 755 /home/james/.cache/yarn

I am told the /home/james/.cache/yarn directory is not found.

So, how exactly can I change this directory's permission?

Additional information: I'm running Windows 10, and I'm actually using Ubuntu on Windows, so to access my folders. I use Ubuntu and write:

james@DESKTOP-VP0F0PN:~$ cd /mnt/c/users/james/documents/github/personalwebsite

then I input the above chmod code after this. Also, to run the server:

james@DESKTOP-VP0F0PN:/mnt/c/users/james/documents/github/personalwebsite$ rails s
like image 238
KuroGane Avatar asked Nov 19 '18 01:11

KuroGane


1 Answers

You have a mix of relative and absolute paths in your examples. You're using a relative path (from $HOME, by using the ~ when you create, but the system is telling you it's looking in the absolute path).

You created the cache file with:

mkdir -p ~/home/james/.cache/yarn

You're trying to chmod this, however:

chmod -R 755 /home/james/.cache/yarn

You probably need to run:

mkdir -p /home/james/.cache/yarn # removed the tilde here
chmod -R 755 /home/james/.cache/yarn

I dropped the ~ in front of the mkdir, which would have created /home/james/home/james/.cache/yarn (assuming you're on Linux)

like image 61
Jay Dorsey Avatar answered Sep 27 '22 20:09

Jay Dorsey