无法从sudo bundle install恢复 [英] cannot recover from `sudo bundle install`
问题描述
由于错误,我在项目上运行了 sudo bundle install
,现在当我自己运行它时 bundle install
我正在获得权限被拒绝的错误(如下)。我在这里尝试了 https://github.com/bundler/ bundler / blob / master / ISSUES.md#other-problems ,也尝试将我的项目克隆到一个新目录并从那里运行bundle,没有用。
by mistake I ran sudo bundle install
on my project and now when I run it as myself bundle install
I am getting permission denied errors (below). I tried the instructions here https://github.com/bundler/bundler/blob/master/ISSUES.md#other-problems, also tried cloning my project into a fresh directory and running bundle from there, no use. Please help!
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'
推荐答案
将存储库克隆到新目录将无济于事。您将gems安装到标准gems目录中,而不是捆绑软件特定的目录中。
Cloning the repo to a new directory would not help. You installed the gems to the standard gems directory instead of a bundle specific directory.
最好的选择是将捆绑软件安装到新目录中,而忽略安装在目录中的gems。
The best option is to install the bundle to a new directory and ignore the gems installed in the system path.
尝试 bundle install --path /home/akonsu/.new_project_bundle
。您不必每次都指定此选项。会记住它。
Try bundle install --path /home/akonsu/.new_project_bundle
. You do not have to specify this option every time. It is remembered.
http://bundler.io/v1.3/man/bundle-install.1.html
此外,您还需要设置以下项的权限注释中提到的捆绑程序的缓存目录(或删除它)。
Also you need to set the permissions of the bundler's cache directory as mentioned in the comments (or delete it).
这篇关于无法从sudo bundle install恢复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!