36

Whenever I try something with yarn on Ubuntu 16.04 server.

It gives an error.

I am currently using nodejs v8.10.0

yarn install v1.5.1
error An unexpected error occurred: "EACCES: permission denied, scandir '/home/ubuntu/.config/yarn/link'".
info If you think this is a bug, please open a bug report with the information provided in "/home/ubuntu/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Anyone know why this is happening?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Astro Lee
  • 411
  • 1
  • 5
  • 9

2 Answers2

128

It's likely a unix permission related problem. There is a solution posted on the dev's github page. Try to run the following command

sudo chown -R $USER:$GROUP ~/.npm
sudo chown -R $USER:$GROUP ~/.config

Reference: EACCES: permission denied .config/configstore/bower-github.json #2262

James Wong
  • 4,529
  • 4
  • 48
  • 65
  • 3
    Worked! used on ~/.yarn – imbatman Feb 01 '19 at 14:38
  • 2 years later, same problem. Nothing works. Even this. That npm and js in general are awesome. – Toma Tomov Jul 30 '20 at 21:16
  • I had to `chown` some `.cache` and `.temp` folders inside the project. I did this - `sudo find . -type d -name '.cache' -or -name '.temp' -exec chown -R $USER:$GROUP -- {} \+;` – Qumber Aug 19 '20 at 07:04
  • 2
    Super helpful answer, thank you. In my case I had run "sudo yarn install" so root owned my node_modules directory. I deleted node_modules directory then reran "yarn install" so that I was the owner and "yarn link" worked. – Lucy Sep 10 '20 at 12:12
  • Im tying to run with root user and thats not works. Whem i run without root user that wroks. – sant0will Oct 01 '21 at 13:13
1

I had this problem as well, I found on another thread that my config folder was owned by root, which created several permissions issues.. I changed owner to my user and this error went away.

See top answer on this thread Unable to access 'git/attributes'