Missing the Rails 2.3.4 gem. Even though it's installed!

我怕爱的太早我们不能终老 提交于 2019-12-22 04:42:17

问题


Running Snow Leopard. Tried uninstalling, and re-installing. Still getting the same error whenever I run a rake task.

mbpro:redmine shereef$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.0.0]

mbpro:redmine shereef$ rails -v
Rails 2.3.4

mbpro:redmine shereef$ which rails
/usr/local/bin/rails

mbpro:redmine shereef$ gem -v
1.3.5

mbpro:redmine shereef$ which gem
/usr/local/bin/gem

mbpro:redmine shereef$ rake -v
(in /Users/shereef/Documents/Code/BetterMeans/redmine)
Missing the Rails 2.3.4 gem. Please gem install -v=2.3.4 rails, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.

mbpro:redmine shereef$ which rake
/usr/bin/rake

mbpro:redmine shereef$ $PATH
-bash: /usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin: No such file or directory

mbpro:redmine shereef$


回答1:


On Fedora 12 you need to

$ gem install -v=1.0.1 rack

for the bundled rails to work.




回答2:


Have you tried running rake:rails:update in your application?




回答3:


I too had faced a similar issue. Please verify whether rails 2.3.4 is installed properly using the "gem list" command. If more than one copy of rails are present in gem list, remove the unwanted version using "gem uninstall rails" and select the required version.




回答4:


Whenever I installed a newer version of rack this would happen. Making sure I had v 1.0.1 made it always work.




回答5:


The solution that worked for me was to remove ruby 1.8.7, reinstall it and use gemsets. This is the code if you're using rvm and ruby is correctly on it.

rvm remove 1.8.7 
rvm package install readline # I'm not sure this is needed...
rvm install 1.8.7 --with-readline-dir=$rvm_path/usr # same here for option
rvm gemset create mine
rvm 1.8.7@mine
rvm use 1.8.7@mine --default # IF you do not want to change rv each terminal
gem install rails -v=2.3.5

I'm not sure but I think that rails was not seen because of the global gemset, but rails is pretty new to me to go deep in the explanation.

Edit: In the case that there is no need to reinstall ruby, this should be enough, in both cases you'll have to reinstall all your gems.

rvm gemset create mine
rvm 1.8.7@mine
rvm use 1.8.7@mine --default # IF you do not want to change rv each terminal
gem install rails -v=2.3.5

let me know...




回答6:


Since you have your own copy of ruby in /usr/local, I suspect that somehow rake is still trying to use the builtin os x ruby/gem command.

Try running 'gem env' to make sure your environment is set up correctly. In particular, look at the GEM PATHS: to make sure they are pointed at your /usr/local directory. If they are wrong try setting GEM_HOME and/or GEM_PATH in your environment.

Here is what my output looks like (though I use a ruby install dir in my own how directory via the ruby_switcher.sh tool (http://github.com/relevance/etc)

    RubyGems Environment:
      - RUBYGEMS VERSION: 1.3.5
      - RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.0.0]
      - INSTALLATION DIRECTORY: /Users/ashebanow/.gem/ruby/1.8
      - RUBY EXECUTABLE: /Users/ashebanow/.ruby_versions/ruby-1.8.7-p174/bin/ruby
      - EXECUTABLE DIRECTORY: /Users/ashebanow/.gem/ruby/1.8/bin
      - RUBYGEMS PLATFORMS:
        - ruby
        - x86-darwin-10
      - GEM PATHS:
         - /Users/ashebanow/.gem/ruby/1.8
      - GEM CONFIGURATION:
         - :update_sources => true
         - :verbose => true
         - :benchmark => false
         - :backtrace => false
         - :bulk_threshold => 1000
         - :sources => ["http://gems.rubyforge.org/", "http://gems.github.com/"]
      - REMOTE SOURCES:
         - http://gems.rubyforge.org/
         - http://gems.github.com/



回答7:


I had similar problems, and another gem to keep an eye on is activesupport. I found if I had other versions that differed from my Rails version, it could cause this as well.



来源:https://stackoverflow.com/questions/1442834/missing-the-rails-2-3-4-gem-even-though-its-installed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!