即使对于已经安装的gem,`bundle install`也会返回错误

时间:2012-02-16 16:06:16

标签: ruby-on-rails ruby rubygems

我是Rails的新手。我安装了Rails很好但是如果我在Gemfile中添加一个额外的gem(任何那些尚未存在的gem)并运行bundle install,我会收到此错误:

$ bundle install
/home/mcrittenden/Dropbox/Code/omgwtf/Gemfile:40:in ``': No such file or directory - rmagick (Errno::ENOENT)
    from /home/mcrittenden/Dropbox/Code/omgwtf/Gemfile:40:in `evaluate'
    from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/dsl.rb:7:in `instance_eval'
    from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/dsl.rb:7:in `evaluate'
    from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/definition.rb:17:in `build'
    from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler.rb:138:in `definition'
    from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/cli.rb:219:in `install'
    from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/vendor/thor/task.rb:22:in `run'
    from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
    from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/vendor/thor.rb:263:in `dispatch'
    from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/vendor/thor/base.rb:386:in `start'
    from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/bin/bundle:13:in `<top (required)>'
    from /usr/bin/bundle:19:in `load'
    from /usr/bin/bundle:19:in `<main>'

即使已经安装了它抱怨的宝石,也会发生这种情况。在这种情况下,gem正确安装在/usr/lib/ruby/gems/1.9.1/gems/中。

关于我可能做错的任何想法?

注意:我知道我应该使用RVM,而且我是,但是为了这篇文章的目的,我没有把它包含在内,以便可以排除它作为可能的罪魁祸首。

1 个答案:

答案 0 :(得分:2)

请告诉我们您的宝石文件。这是一条重要的信息。我的理论是你写了require 'rmagick'但它应该是gem 'rmagick'

我的另一个理论是你使用了后面的刻度而不是引号。请复制并粘贴您的gem文件,以便我们可以准确地看到您所写的内容。