MacOS 终端中的问题 运行 捆绑包安装

Problem running bundle install in MacOS terminal

当运行 bundle install时,我得到错误

There was an error while trying to write to
'/Users/my-user/.bundle/cache/compact_index/rubygems.org.443.29b0360b937aa4d161703e6160654e47/versions'.
It is likely that you need to grant write permissions for that path.

我正在 Ruby 版本 2.3.3 使用平台 x86_64-darwin18。 他们对如何修复此错误有任何建议吗?

我已经尝试解锁文件了,但是它说文件无法解锁,只提供了复制的机会。

你能试试吗,

1) chown -R USERNAME /Users/my-user/.bundle/cache/compact_index/

2) sudo bundle install

3) bundle exec bundle install

4) 只需给 chown -R USERNAME /Users/my-user/.bundle/cache/

权限

5) rm -rf /Users/my-user/.bundle/cache

将 USERNAME 替换为您的系统用户名