错误地,我在我的项目上运行了sudo bundle install
,现在,当我以bundle install
身份运行它时,我得到的是被拒绝的权限错误(如下)。我尝试了这里的说明-- https://github.com/bundler/bundler/blob/master/ISSUES.md#other-problems,还尝试将我的项目克隆到一个新的目录中,然后从那里运行包,没有用。请帮帮我!
error: cannot open .git/FETCH_HEAD: Permission denied
Retrying git fetch --force --quiet --tags "/home/akonsu/.bundler/cache/git/em-postgresql-adapter-361cdc05eba5661bb17040a7a6c2a093f9c2263b" due to error (2/3): Bundler::Source::Git::GitCommandError Git error: command `git fetch --force --quiet --tags "/home/akonsu/.bundler/cache/git/em-postgresql-adapter-361cdc05eba5661bb17040a7a6c2a093f9c2263b"` in directory /usr/local/lib/ruby/gems/2.1.0/bundler/gems/em-postgresql-adapter-3dfcc60378e9 has failed.
If this error persists you could try removing the cache directory '/home/akonsu/.bundler/cache/git/em-postgresql-adapter-361cdc05eba5661bb17040a7a6c2a093f9c2263b'
error: cannot open .git/FETCH_HEAD: Permission denied
Retrying git fetch --force --quiet --tags "/home/akonsu/.bundler/cache/git/em-postgresql-adapter-361cdc05eba5661bb17040a7a6c2a093f9c2263b" due to error (3/3): Bundler::Source::Git::GitCommandError Git error: command `git fetch --force --quiet --tags "/home/akonsu/.bundler/cache/git/em-postgresql-adapter-361cdc05eba5661bb17040a7a6c2a093f9c2263b"` in directory /usr/local/lib/ruby/gems/2.1.0/bundler/gems/em-postgresql-adapter-3dfcc60378e9 has failed.
If this error persists you could try removing the cache directory '/home/akonsu/.bundler/cache/git/em-postgresql-adapter-361cdc05eba5661bb17040a7a6c2a093f9c2263b'
error: cannot open .git/FETCH_HEAD: Permission denied
Git error: command `git fetch --force --quiet
--tags "/home/akonsu/.bundler/cache/git/em-postgresql-adapter-361cdc05eba5661bb17040a7a6c2a093f9c2263b"` in directory
/usr/local/lib/ruby/gems/2.1.0/bundler/gems/em-postgresql-adapter-3dfcc60378e9
has failed.
If this error persists you could try removing the cache directory
'/home/akonsu/.bundler/cache/git/em-postgresql-adapter-361cdc05eba5661bb17040a7a6c2a093f9c2263b'
发布于 2014-09-27 19:53:17
将回购文件克隆到新目录不会有帮助。您将这些gems安装到标准的gems目录中,而不是一个包特定的目录。
最好的选择是将包安装到一个新目录中,而忽略系统路径中安装的gems。
试试bundle install --path /home/akonsu/.new_project_bundle
。您不必每次都指定此选项。这是被记住的。
http://bundler.io/v1.3/man/bundle-install.1.html
此外,您还需要像注释中提到的那样设置bundler缓存目录的权限(或者删除它)。
发布于 2014-11-25 13:29:34
今天我的mac电脑里也有同样的问题。我通过删除文件夹~/.bundle
来解决这个问题。
在那之后,我运行了bundle install --path ~/.bundle
,一切都正常了。
发布于 2015-05-19 20:07:16
阅读邦德勒网站上的内容,不需要任何外部帮助。
gems将安装到您的默认系统位置的Gems。如果您的系统gems存储在根拥有的位置(例如在Mac中),bundle将要求您的根密码在那里安装它们。
在安装gems时,Bundler将检查供应商/缓存,然后检查系统的gems。如果gem没有缓存或安装,Bundler将尝试从Gemfile中声明的源安装它。
默认为--system
选项。在使用--path
选项后,将其传递回交换机,如下所述。
将您的依赖项(甚至已经安装到您的系统gems上的gems )安装到系统宝石存储库以外的位置。在本例中,将它们安装到供应商/包中。
$ bundle install --path vendor/bundle
进一步捆绑对Bundler.setup或Bundler.require的命令或调用将记住这个位置。
来源:install.html
https://stackoverflow.com/questions/26078493
复制相似问题