纱线错误 "EACCESS: permission denied, scandir '/home/ubuntu/.config/yarn/link'"

yarn error "EACCESS: permission denied, scandir '/home/ubuntu/.config/yarn/link'"

每当我在 Ubuntu 16.04 服务器上尝试使用 yarn 时。

报错

我目前使用的是 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.

有人知道为什么会这样吗?

这可能是与 unix 权限相关的问题。开发人员的 github 页面上发布了一个解决方案。尝试 运行 以下命令

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

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

我也有这个问题,我在另一个线程上发现我的配置文件夹归 root 所有,这造成了几个权限问题。我将所有者更改为我的用户,这个错误消失了。

查看此主题的最佳答案 Unable to access 'git/attributes'