ubuntu 12.04 ruby 2.0 rails: Could not find 't

2019-07-24 20:16发布

问题:

im installing rails on ubuntu 12.04. installed manualy, using this method: How do I install ruby 2.0.0 correctly on Ubuntu 12.04?

then:

gem update --system 
gem install rails

now if i run command "rails" the output is as following:

/usr/local/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:298:in `to_specs': Could not find 'thread_safe' (~> 0.1) - did find: [thread_safe-0.1.2-java] (Gem::LoadError)
        from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:1265:in `block in activate_dependencies'
        from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:1254:in `each'
        from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:1254:in `activate_dependencies'
        from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:1236:in `activate'
        from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:1268:in `block in activate_dependencies'
        from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:1254:in `each'
        from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:1254:in `activate_dependencies'
        from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:1236:in `activate'
        from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:48:in `gem'
        from /usr/local/bin/rails:22:in `<main>'

edit:

yes i tryed:

gem install --version 0.1.2 thread_safe
gem uninstall thread_safe
gem install thread_safe

after reinstalling thread_safe rails gave me the same error

回答1:

Seems you are using 2.1.0 version of rubygems. It's not bug of tread_safe or atomic gems, but it's bug of rubygems 2.1.0. Try to install older version (like 2.0.8). How to do this:

gem uninstall rubygems-update
gem install rubygems-update --version 2.0.8
update_rubygems


回答2:

The error message says thatyou don't have thread_safe version ~>0.1, and that it found thread_safe version 0.1.2-java,but i guess this version was not compatible/satisfactory.

probably somehow the non-java version was not getting installed coz of the presence of the java version. install the gem separately.

gem install --version 0.1.2 thread_safe


回答3:

so i searched for atomic gems, found atomic (1.1.14 ruby java). mine was atomic (1.1.13 java). It might be because i had no JDK 8 installed, but after installing atomic (1.1.14 ruby java) command rails gives me nice list of available parameters.

rails new test_app = success!!!