Yarn: Skipping preferred cache folder due to permissions

Created on 28 Oct 2017  路  3Comments  路  Source: yarnpkg/yarn

yarn v1.2.1

I keep getting this warning when doing yarn install or yarn add <pkg>:

warning Skipping preferred cache folder "/Users/<username>/Library/Caches/Yarn" because it is not writable.
warning Selected the next writable cache folder in the list, will be "/var/folders/qy/twf1cmk52nd_9fz96f89vxsr0000gn/T/.yarn-cache".

Obviously sudo fixes this but sudo should not be required, I'm guessing something is probably wrong on my end. I have not reconfigured the cache folder, is this the default? Am I suppose to have access to it?

On macOS Sierra v10.12.6. I had previosuly installed it using npm install -g yarn but uninstalled that and switched to brew for the update (and in the hope of fixing this).

Most helpful comment

Yup, that folder should be readable and writeable by your current user. I'm guessing you've used sudo yarn install at some point.

We've just merged a patch that makes this harder but it would still print the warning.

How is this helpful? Any steps to solve?

All 3 comments

Yup, that folder should be readable and writeable by your current user. I'm guessing you've used sudo yarn install at some point.

We've just merged a patch that makes this harder but it would still print the warning.

Yup, that folder should be readable and writeable by your current user. I'm guessing you've used sudo yarn install at some point.

We've just merged a patch that makes this harder but it would still print the warning.

How is this helpful? Any steps to solve?

Set the ownership back to your current user, using chown:

```bash
sudo chown /Users/Library/Caches/Yarn
````

Was this page helpful?
0 / 5 - 0 ratings