【问题标题】:Bundle doesn't want to install a gem (not yet checked out)Bundle 不想安装 gem(尚未签出)
【发布时间】:2014-03-21 09:05:44
【问题描述】:

我想在 Rails 服务器上运行 Ruby,但不想安装某个 gem。这个rails程序和ruby 2.0不兼容,所以我想用ruby 1.9.3,我已经安装了,但是不能再捆绑安装了……

$ bundle install
# ...
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
$ bundle exec rails s
git://github.com/goodtouch/jbuilder.git (at master) is not yet checked out. Run `bundle install` first.
$ bundle show jbuilder
/Users/julien/.bundler/ruby/2.0.0/jbuilder-7fb0eae924c7
$ ruby --version
ruby 1.9.3p545 (2014-02-24 revision 45159) [x86_64-darwin13.1.0]

Gemfile中,我指定ruby "1.9.3",然后我再次运行bundle install,得到:

Your Ruby version is 2.0.0, but your Gemfile specified 1.9.3

此特定 gem 的 Gemfile 行:

gem 'jbuilder', git: "git://github.com/goodtouch/jbuilder.git"

以及我在Gemfile.lock 中得到的信息:

GIT
  remote: git://github.com/goodtouch/jbuilder.git
  revision: 7fb0eae924c77318ede344f32a5c208b91cdbaac
  specs:
    jbuilder (0.4.1)
      activesupport (>= 3.0.0)
      blankslate (>= 2.1.2.4)

我真的不明白发生了什么。我在 Mac OS X 下。

谢谢。

【问题讨论】:

  • 你使用rvm?在指定 ruby '1.9.3'bundle install 之前运行 ruby -vrvm use 1.9.3 我认为你仍然使用 2.0.0...
  • 从捆绑器日志有这个 /Users/julien/.bundler/ruby/2.0.0/jbuilder-7fb0eae924c7 这意味着 ruby​​ 版本仍然是 2.0.0
  • 是的,我知道,但我想知道他在哪里可以找到这个版本的 ruby​​... =°

标签: ruby-on-rails ruby gem bundler


【解决方案1】:

编辑:您必须使用rvmrbenv 来设置ruby 版本。这不是在 gem 文件中设置的。 Ruby 不是宝石。

此错误可能有多种原因之一。

来自Bundler issues

# remove user-specific gems and git repos
rm -rf ~/.bundle/ ~/.gem/bundler/ ~/.gems/cache/bundler/

# remove system-wide git repos and git checkouts
rm -rf $GEM_HOME/bundler/ $GEM_HOME/cache/bundler/

# remove project-specific settings
rm -rf .bundle/

# remove project-specific cached gems and repos
rm -rf vendor/cache/

# remove the saved resolve of the Gemfile
rm -rf Gemfile.lock

# uninstall the rubygems-bundler and open_gem gems
rvm gemset use global # if using rvm
gem uninstall rubygems-bundler open_gem

# try to install one more time
bundle install

【讨论】:

  • 谢谢,我使用了 rbenv 但显然它不起作用,使用rvm 更容易并且它有效!谢谢!
  • 很高兴为您提供帮助!我也更喜欢rvm。我认为 rvm 更容易让我理解。对于两者之间的最大差异,请看这个。 Why rbenv?
猜你喜欢
  • 1970-01-01
  • 2017-01-18
  • 1970-01-01
  • 2017-08-27
  • 2023-03-21
  • 2013-01-05
  • 2018-11-30
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多