ruby - 无法从 `sudo bundle install` 恢复

标签 ruby bundler

我错误地在我的项目上运行了 sudo bundle install,现在当我以自己的身份运行它时 bundle install 我得到了权限被拒绝的错误(如下)。我在这里尝试了说明 https://github.com/bundler/bundler/blob/master/ISSUES.md#other-problems ,还尝试将我的项目克隆到一个新目录并从那里运行 bundle,但没有用。请帮忙!

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'

最佳答案

今天我的 mac 遇到了同样的问题。我通过删除文件夹 ~/.bundle 解决了这个问题。

之后我运行 bundle install --path ~/.bundle 一切又都正常了。

关于ruby - 无法从 `sudo bundle install` 恢复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26078493/

相关文章:

ruby-on-rails - `rails server` 抛出错误 "cannot load such file"-- sass/logger (LoadError)

java - 为 HTML/JS/CSS 编写一个小文件打包器

javascript - 如何在 PhpStorm 中 bundle JavaScript 文件

ruby - 哈希可枚举方法 : Inconsistent behavior when passing only one parameter

ruby-on-rails - 如何检查将脚本/运行程序作为 shebang 的 ruby​​ 脚本的语法?

ruby - 如何使用本地安装的 gem 执行 Ruby 程序?

ruby-on-rails - 如何使用相同的Rpec测试来测试Rails项目的生产版本?

ruby - 如何配置 Bundler/Gemfile 以在开发期间使用不同的 gem 源?

ruby - 强制 bundle 安装使用 https ://instead of git://for GitHub-based gems

ruby - 如何从 Ruby 中的循环创建类的实例?