Rails commands in the home directory result in the error "i18n gem is not available"

I was in the Ubuntu home directory trying to create a new rails application with rails new , but I got this error:

I18n pearls are not available. Add it to your Gemfile and run the package installer

Any rails command that I run gives this error. I'm really confused because I'm not in the application. I'm just in my home directory. No gemfile. I tried installing "i18n" in my home directory with gem install 'i18n' and it worked, but I still get this error.

I have never had problems with rails commands in my home directory. All rail related functions usually work when I cd in my individual applications. What's happening?

Also , now I get the same error in all my existing rails applications. Did the rails suddenly rely on this stone? Or can I delete a stone in my home directory, one way or another, that it is not available in my applications?


UPDATE

I tried gem cleanup rails and reinstalled, but nothing changed. Here is the result:

 $ gem cleanup rails Cleaning up installed gems... Attempting to uninstall rails-4.0.10 Successfully uninstalled rails-4.0.10 Attempting to uninstall rails-4.2.1 Successfully uninstalled rails-4.2.1 Attempting to uninstall rails-4.2.4 Successfully uninstalled rails-4.2.4 Attempting to uninstall rails-5.0.1 Successfully uninstalled rails-5.0.1 Attempting to uninstall rails-5.0.2 Successfully uninstalled rails-5.0.2 Attempting to uninstall rails-5.0.3 Successfully uninstalled rails-5.0.3 Attempting to uninstall rails-5.0.4 Successfully uninstalled rails-5.0.4 Clean Up Complete $ gem install rails -v 5.0.1 Fetching: rails-5.0.1.gem (100%) Successfully installed rails-5.0.1 Parsing documentation for rails-5.0.1 Installing ri documentation for rails-5.0.1 Done installing documentation for rails after 1 seconds 1 gem installed $ rails -v The i18n gem is not available. Please add it to your Gemfile and run bundle install 

UPDATE 2

I previously manually installed i18n and I thought this might be a problem, so I uninstalled both rails and i18n and reinstalled rails . But I still get the error:

  $ gem uninstall rails --all You have requested to uninstall the gem: rails-5.0.1 browser-2.3.0 depends on rails (>= 0, development) browser-1.1.0 depends on rails (>= 0, development) browser-0.9.1 depends on rails (>= 0, development) carrierwave-1.2.1 depends on rails (>= 4.0.0, development) carrierwave-1.0.0 depends on rails (>= 4.0.0, development) rails_serve_static_assets-0.0.5 depends on rails (>= 3.1, development) rails_serve_static_assets-0.0.4 depends on rails (>= 3.1, development) sass-rails-4.0.5 depends on rails (>= 0, development) sunspot_rails-2.2.7 depends on rails (>= 3) twitter-typeahead-rails-0.10.5 depends on rails (>= 3.1, development) yaml_db_improved-1.0.1 depends on rails (>= 0) If you remove this gem, these dependencies will not be met. Continue with Uninstall? [yN] y Successfully uninstalled rails-5.0.1 $ gem uninstall i18n --all You have requested to uninstall the gem: i18n-0.9.1 activesupport-5.1.4 depends on i18n (~> 0.7) activesupport-5.0.5 depends on i18n (~> 0.7) activesupport-5.0.4 depends on i18n (~> 0.7) activesupport-5.0.3 depends on i18n (~> 0.7) activesupport-5.0.2 depends on i18n (~> 0.7) activesupport-5.0.1 depends on i18n (~> 0.7) activesupport-4.2.4 depends on i18n (~> 0.7) activesupport-4.2.1 depends on i18n (~> 0.7) activesupport-4.0.10 depends on i18n (>= 0.6.9, ~> 0.6) capistrano-3.8.0 depends on i18n (>= 0) capistrano-3.7.2 depends on i18n (>= 0) If you remove this gem, these dependencies will not be met. Continue with Uninstall? [yN] y Successfully uninstalled i18n-0.9.1 $ gem install rails --version 5.0.1 Fetching: i18n-0.9.1.gem (100%) Successfully installed i18n-0.9.1 Fetching: rails-5.0.1.gem (100%) Successfully installed rails-5.0.1 Parsing documentation for i18n-0.9.1 Installing ri documentation for i18n-0.9.1 Parsing documentation for rails-5.0.1 Installing ri documentation for rails-5.0.1 Done installing documentation for i18n, rails after 4 seconds 2 gems installed $ rails -v The i18n gem is not available. Please add it to your Gemfile and run bundle install /home/user/.rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems/specification.rb:2278:in `check_version_conflict': can't activate activesupport-5.1.4, alrea ... 
+5
source share
5 answers

Try gem install rails again. Or gem install rails -v 5.0 to install a specific version.

It looks like you have no rails and dependencies are fully installed. Perhaps because you reinstalled the ruby ​​or installed a different ruby ​​version. If I'm right, what happens, just reinstall the latest version of the rails or the version you want, and everything you need will be there again.

+2
source

You may have several rails installed. Maybe try running gem cleanup rails

For more information about the command, see gem cleanup --help

Edit: and of course you will have to install the rails again. Either the latest stable version, or whatever you prefer.

UPDATE

Looking at your gem install output, it does not seem to install any dependencies, so it is assumed that you have already installed i18n.

Here is what you can do:

  • Check which versions you have installed. Launch gem list | grep i18n gem list | grep i18n and grep rails respectively.

  • Remove all versions of these gems through gem uninstall i18n --all and gem uninstall rails --all respectively

  • Install the rails gem install rails --version 5.0.1 and it should output Successfully installed i18n-0.9.1 during the installation process.

Here is my conclusion:

 # blank slate $ rails -v Rails is not currently installed on this system. # successful rails install $ gem install rails -v 5.0.1 ... Fetching: i18n-0.9.1.gem (100%) Successfully installed i18n-0.9.1 ... 35 gems installed # verify installed gems $ gem list | grep rails rails (5.0.1) ... $ gem list | grep i18n i18n (0.9.1) # break i18n $ gem uninstall i18n --all You have requested to uninstall the gem: i18n-0.9.1 activesupport-5.0.1 depends on i18n (~> 0.7) If you remove this gem, these dependencies will not be met. Continue with Uninstall? [yN] y Successfully uninstalled i18n-0.9.1 $ rails -v /Users/me/.rvm/rubies/ruby-2.3.6/lib/ruby/site_ruby/2.3.0/rubygems/dependency.rb:308:in `to_specs': Could not find 'i18n' (~> 0.7) among 51 total gem(s) (Gem::MissingSpecError) # fix i18n and rails $ gem uninstall rails --all Successfully uninstalled rails-5.0.1 $ gem uninstall i18n --all $ gem install rails --version 5.0.1 Fetching: i18n-0.9.1.gem (100%) Successfully installed i18n-0.9.1 Fetching: rails-5.0.1.gem (100%) Successfully installed rails-5.0.1 2 gems installed # working again $ rails -v Rails 5.0.1 
+1
source

Do you use any version manager, rvm or rbenv ? You should use this to prevent inconsistencies in the installation of libraries and to ensure the orderliness of your packages.

I suggest you uninstall everything related to Ruby and install Rbenv. A quick search with this error, I found that this mainly relates to RVM. I could be wrong, but I will try with Reben. Use Rbenv to configure Ruby in Ubuntu. Here is a link to Rbenv in Ubuntu 16.04

Also, why not try creating a gemfile and actually add the gem 'i18n', '~> 0.7.0' .

Then run bundle install . If he says this gem is blocked, use bundle update i18n

What he says?

And also what you get with which -a ruby

+1
source

So, I still don’t understand what exactly is happening, but I deleted the rails with gem uninstall rails and then reinstalled it only with gem install rails , and now the rails commands work. Apparently, the problem was not even related to i18n. I have a complete loss. At least now it works!

+1
source

The problem is i8ln in the place where ruby ​​is installed.

for instance

Ruby2.3.3\lib\ruby\gems\2.3.0\gems

Try reinstalling ruby ​​and try.

Before you perform a new installation, make sure that you delete all ruby ​​files.

0
source

Source: https://habr.com/ru/post/1274699/


All Articles