【问题标题】:Correcting Bundle permissions after executing sudo bundle install执行 sudo bundle install 后更正 Bundle 权限
【发布时间】:2016-01-15 19:41:48
【问题描述】:

运行sudo bundle install 后,我无法执行没有前缀sudo 的任何命令。例如,如果我想生成迁移

 rails generate migration AddLastNameToCandidates last_name:string

会报错

Could not find rake-10.5.0 in any of the sources
Run `bundle install` to install missing gems.

但是,如果我运行

 sudo rails generate migration AddLastNameToCandidates last_name:string

迁移成功生成。

如何恢复此操作并运行诸如bundle install 之类的命令,而不必以 sudo 执行它?

【问题讨论】:

  • 使用Ruby环境为github.com/rbenv/rbenv
  • 我读到了一点。但它只有助于维护相同的红宝石版本或宝石?...
  • 是的,在 shell 中设置类型 gem 环境后查看 gem 路径:例如宝石路径:-~/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0
  • 我的 rails 是通过 rvm 安装的...是一样的吗?我不能对 rvm 做同样的事情吗??
  • 首先从系统中删除 RVM,因为它与 rbenv 不兼容。用 $ rvm implode 删除,然后设置。操作方法reinteractive.net/posts/12-moving-from-rvm-to-rbenv

标签: ruby-on-rails gemfile


【解决方案1】:

编辑:我一直在尝试,这是因为每个 gem 确实都在 sudo 域下。我在这篇文章中找到了解决方案

Could not find rake-10.0.4 in any of the sources (Bundler::GemNotFound)

Sometimes we don’t get response from http://rubygems.org/. So it will show the given error.

You can use following ways for fixing this issue

    Try again for gem install using gem install rack command and run bundle update rake for updating your Gemfile.lock file.
    Delete the Gemfile.lock and again bundle install it.

现在每个命令都可以在没有 sudo 前缀的情况下完美运行

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-09-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-31
    • 1970-01-01
    • 2011-08-17
    相关资源
    最近更新 更多