纱线错误"EACCESS:权限被拒绝,scandir'/home/ubuntu/.config/yarn/link'"

Ast*_*Lee 15 ubuntu node.js npm yarnpkg

每当我在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.
Run Code Online (Sandbox Code Playgroud)

任何人都知道为什么会这样吗?

Jam*_*ica 54

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

sudo chown -R $USER:$GROUP ~/.npm
sudo chown -R $USER:$GROUP ~/.config
Run Code Online (Sandbox Code Playgroud)

参考:EACCES:权限被拒绝.config/configstore/bower-github.json#2262

  • 工作了!用于〜/ .yarn (2认同)
  • 超级有帮助的答案,谢谢。就我而言,我运行了“sudo yarn install”,因此 root 拥有我的 node_modules 目录。我删除了node_modules目录,然后重新运行“yarn install”,这样我就是所有者并且“yarn link”起作用了。 (2认同)