ruby-on-rails – 找不到gem rails – Gem :: GemNotFoundException

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 找不到gem rails – Gem :: GemNotFoundException前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
使用ubuntu 10.04,rvm.起初我已经用rvm,gem rails安装了 ruby 1.9.2,并生成了一些新的项目并成功启动.一切都很好.但是在更改为另一个项目之后,执行bundle install命令(输出看起来就OK)并启动rails server – 发生错误

轨道

/home/jacek/.rvm/rubies/ruby-1.9.2-p318/lib/ruby/site_ruby/1.9.1/rubygems.rb:316:in `bin_path': can't find gem rails ([">= 0"]) with executable rails (Gem::GemNotFoundException)
from /home/jacek/.rvm/gems/ruby-1.9.2-p318/bin/rails:19:in `<main>'

宝石列表轨

*** LOCAL GEMS ***
rails (3.2.2)

宝石环境

RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.18
  - RUBY VERSION: 1.9.2 (2012-02-14 patchlevel 318) [i686-linux]
  - INSTALLATION DIRECTORY: /home/jacek/.rvm/gems/ruby-1.9.2-p318
  - RUBY EXECUTABLE: /home/jacek/.rvm/rubies/ruby-1.9.2-p318/bin/ruby
  - EXECUTABLE DIRECTORY: /home/jacek/.rvm/gems/ruby-1.9.2-p318/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-linux
  - GEM PATHS:
     - /home/jacek/.rvm/gems/ruby-1.9.2-p318
     - /home/jacek/.rvm/gems/ruby-1.9.2-p318@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

我的路径(包括EXECUTABLE DIRECTORY:/home/jacek/.rvm/gems/ruby-1.9.2-p318/bin)

/home/jacek/.rvm/gems/ruby-1.9.2-p318/bin:/home/jacek/.rvm/gems/ruby-1.9.2-p318@global/bin:/home/jacek/.rvm/rubies/ruby-1.9.2-p318/bin:/home/jacek/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

我会感谢任何帮助

解决方法

如果您使用命令包安装从GEMFILE安装您的宝石,它会将宝石安装到宝石的默认系统位置,如 the bundler docs here所示.之后,您可以使用bundlers bundle exec命令在捆绑的上下文,as outlined in the docs here.这将确保您使用捆绑安装安装的gem版本被执行.

如果您查看了homepage for bundler,该文档提供了文档的概述,它将说明如下内容

In some cases,running executables without bundle exec may work,if the executable happens to be installed in your system and does not pull in any gems that conflict with your bundle.

However,this is unreliable and is the source of considerable pain. Even if it looks like it works,it may not work in the future or on another machine.

我猜测你在控制台中运行gem,然后在控制台中运行bundle show rails,系统的默认安装rails安装与为您的bundle安装的rails安装不同.

你说你正在使用rvm进行红宝石和宝石管理.我以为你可能没有正确配置它.尝试在控制台中执行rvm notes命令,以确保您已经解决了在操作系统上安装所需的/建议的所有步骤.当您运行echo $PATH时,您希望确保rvm的可执行文件是路径中包含的第一项内容.这将确保为rvm安装的gem将是当您尝试执行它们而不使用bundle exec前缀时执行的gem.如果rvm注释没有提供完成这一点所需的提示,那么请仔细阅读docs for installation on the RVM website.

原文链接:https://www.f2er.com/ruby/272598.html

猜你在找的Ruby相关文章