I'm getting this error when trying to run the gem command. Does anyone know what is causing this? It's causing me to be not able to run rails g migration commands (I get a similar error), and I'd imagine probably a lot more.
Error loading RubyGems plugin "/Users/storwell/.rvm/gems/ruby-2.0.0-p247#global/gems/executable-hooks-1.2.2/lib/rubygems_plugin.rb": undefined method `stubs' for Gem::Specification:Class (NoMethodError)
/Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:255:in `matching_specs': undefined method `stubs' for Gem::Specification:Class (NoMethodError)
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:279:in `to_specs'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:309:in `to_spec'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:53:in `gem'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rubygems.rb:572:in `load_yaml'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/config_file.rb:327:in `load_file'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/config_file.rb:196:in `initialize'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/gem_runner.rb:74:in `new'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/gem_runner.rb:74:in `do_configuration'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/gem_runner.rb:39:in `run'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/bin/gem:21:in `<main>'
Update: I've also tried the rake command and it throws the same error.
I found an older link related to the same problem
, and it seems that it might be either a (1) Ruby installation issue, or (2) RubyGem issue. If it a Ruby issue, you need to uninstall and reinstall Ruby by using RVM (Ruby Version Manager) it seems that it worked for some. If it's (2) RubyGem issue (which it probably is), you either have to delete '/Users/storwell/.rvm/gems/ruby-2.0.0-p247#global/gems/executable-hooks-1.2.2/' folder or change the content in rubygems_plugin.rb file.
One of the users suggested (you can find from the link):
*"When I use "gem -v", the response will give me the error "Error loading RubyGems plugin "/Users/mercury/.rvm/gems/ruby-1.9.3-p194#global/gems/rubygems-bundler-0.2.8/lib/rubygems_plugin.rb": cannot load such file -- rubygems_bundler/rubygems_bundler_installer (LoadError)
So I edit "rubygems_plugins.rb", and I change the require path of rubygems_bundler, the path after modified is "./rubygems_bundler/{file_name}", and the problem solved."*
I hope these instructions + link will help you to solve the problem. I did go through the same tutorial book by Michael Hartl last summer. I think I have encountered a similar issue. I think I might have deleted one folder in order solve the issue, and perhaps reinstalled something as well (but I am not 100% because it has been a while) .
Try calling
$gem update --system
Related
I'm on Windows 10 and am a complete beginner programmer. I am using Ruby 2.4.2, Rails 5.1.4 and am following a Lynda course on how to run Rails 5 on Windows.
There's a part near the end where the tutor says to enter:
>rails db:schema:dump
to test whether you've established a connection to the MySQL by create a file inside the created project.
This is what I get when I enter the above command:
C:\Users\notmyactualuser\Documents\Sites\demo_project>rails db:schema:dump
rails aborted!
LoadError: cannot load such file -- mysql2/2.4/mysql2
C:/Users/notmyactualuser/Documents/Sites/demo_project/config/application.rb:7:in `<top (required)>'
C:/Users/notmyactualuser/Documents/Sites/demo_project/Rakefile:4:in `require_relative'
C:/Users/notmyactualuser/Documents/Sites/demo_project/Rakefile:4:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
(See full trace by running task with --trace)
The tutor doesn't address what to do with potential errors and I can't seem to find an answer. I want to build a login form using RoR and am trying to grasp the basics (clearly failing). If possible, can I get help with the above and be directed to an easy, simple, "how-to" on building a login form?
Thanks a lot.
P.S. My first post, so please go easy on me, lol.
UPDATE: So I used the command on CMD and it looks like it's successful. Can somebody point me to how to get it working with Rails?
UPDATE 2: I put in the command that Hoa requested and I got this:
ERROR: "bundle install" was called with arguments ["mysql2"]
Usage: "bundle install [OPTIONS]"
UPDATE 3: I did as Satishkakumar said and I got this:
You've installed the binary version of mysql2.
It was built using MySQL Connector/C version 6.1.6.
It's recommended to use the exact same version to avoid potential issues.
At the time of building this gem, the necessary DLL files were retrieved from:
http://cdn.mysql.com/Downloads/Connector-C/mysql-connector-c-6.1.6-win32.zip
This gem includes vendor/libmysql.dll with redistribution notice in vendor/README.
======================================================================================================
Looks like it's all sorted now? Please let me know if there's any more.
I think its issue of installing mysql2 gem in system. Follow below steps to install.
In Gemfile add the line
gem 'mysql2', '0.3.21'
And run bundle install from project folder in CMD.
bundle install mysql2
This might solve your issue. Let me know in comment section if your issue still persists.
I have had this issue and I have not been able to solve it. I have posted two questions prior to this. The problem is with the rails server (WEBrick). It was running fine in development. I installed a simple jquery-ui gem and ran bundle install and bundle update and the server stopped working. The error is given below.
Server Error
warning: previous definition of APP_PATH was here
Error: Command '-b' not recognized
Usage: rails COMMAND [ARGS]
After doing further investigation, I realized that the way to fix this is updating bin, so I ran the command, rake rails:update:bin. This also gave me an error. The snippet of the error is given below.
rake aborted!
LoadError: cannot load such file -- net/ssh
/home/ubuntu/workspace/config/application.rb:7:in `<top (required)>'
/home/ubuntu/workspace/Rakefile:4:in `<top (required)>'
I figured that if I could fix the rake command issue, I could potentially run the command and fix the server problem. I tried looking for solution on the web, however, they were focused towards MySQL database. I run sqlite3 version 1.3.9 in development. I have looked for potential reasons why rake rails:update:bin command would fail and give me that error but I haven't found a clear answer. I have never changed any of the code in the config/bin directory. Everything looks normal.
I have been trying to debug the this problem for the past two days. I have had no luck. I have tried to un-install gems such as spring and PostgreSQL and installed them again to see if they causing any problems. Not the problem. I have read almost every suggestion on the web. None of them really have the same issue as mine. If anyone can help me figure this problem out, It would be a great deal of help. Any documentation, posts or anything that can help me solve the problem would be highly appreciated. I hope I made myself clear and included all the relevant information, I tried to keep it concise. If any additional detail is needed, please do let me know. Again, any help would be appreciated. Thanks!!!
here is very similar post.
Ruby on rails - cannot load such file -- net/ssh
Only you need is add this to your Gemfile and install.
gem 'net-ssh'
It worked for me.
I'm new to programming and am trying to set up Ruby on Rails using Michael Hartl's tutorial via Terminal on a Mac running Snow Leopard, but I'm a bit stuck on this part. I've tried using rvm 1.9.2, without any luck, and haven't been able to find anything googling. Any help would be appreciated!
Thanks!
CZom$ gem install rails -v 3.2.3
/Users/CZom/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/config_file.rb:253:in `read': Is a directory - /Users/CZom/.gemrc (Errno::EISDIR)
from /Users/CZom/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/config_file.rb:253:in `load_file'
from /Users/CZom/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/config_file.rb:191:in `initialize'
from /Users/CZom/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:78:in `new'
from /Users/CZom/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:78:in `do_configuration'
from /Users/CZom/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:51:in `run'
from /Users/CZom/.rvm/rubies/ruby-1.9.3-p194/bin/gem:25:in `<main>'
/Users/CZom/.gemrc should be a user specific config file that gets loaded when executing the gem command. Sounds like in your case it is a directory instead. Rubygems is complaining therefore.
Try to rename /Users/CZom/.gemrc or remove it completely if it isn't needed.
I've been following Hartl's RoR tutorial and have hit an error in the sequence to set up Rails. I'm running OS X Lion 10.7.3.
http://ruby.railstutorial.org/ruby-on-rails-tutorial-book?version=3.2#sec:rubygems
I've installed Git as instructed. I've installed RVM (1.10.3) in order to update Ruby to 1.9.3 (1.9.3p125 is the version displayed when I type "$ruby -v").
I have updated RubyGems to 1.8.17, the version fixed for the tutorial.
I used vi to create a gem configuration file, per the tutorial. I may have screwed this up somehow since I'm not familiar with vi, but this was the last thing that I did before hitting this error:
jboggan$ gem install rails -v 3.2.2
/Users/jboggan/.rvm/rubies/ruby-1.9.3 p125/lib/ruby/site_ruby/1.9.1/rubygems/config_file.rb:183:in `merge': can't convert String into Hash (TypeError)
from /Users/jboggan/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/config_file.rb:183:in `initialize'
from /Users/jboggan/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:78:in `new'
from /Users/jboggan/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:78:in `do_configuration'
from /Users/jboggan/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:51:in `run'
from /Users/jboggan/.rvm/rubies/ruby-1.9.3-p125/bin/gem:25:in `<main>'
I'd appreciate any input into getting past this. I've searched but been unable to find anyone else having this problem. This is my first post on SO, so please tell me if I need to provide more info, fix my phrasing, or do something to make the question more intelligible. Thanks so much!
I incorrectly edited my .gemrc file during the tutorial. I deleted the offending file and was able to install Rails 3.2.2 normally. See answer from No rails commands will run .
I was trying to use rspec and for some reason it wasn't working. I think it lacked some dependencies or something. Everything else in Ruby 1.9 was working perfectly on my laptop though. So I did a ruby gems system update (sudo gem update --system). I then did a gem update (sudo gem update). When I tried to run or create apps in rails I get the below listed error message: I also get this same message when I try to do gem update, gem install, gem clean, etc. I am confused. I even tried to update bundler to the latest version but I still get this same error message. I hope someone can help. Thanks.
demetrius-fords-macbook-pro-17:~ demet8$ gem check
/usr/local/lib/ruby/gems/1.9.1/gems/bundler-0.8.1/lib/rubygems_plugin.rb:2:in require': no such file to load -- bundler/commands/bundle_command (LoadError)
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-0.8.1/lib/rubygems_plugin.rb:2:in'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:1113:in load'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:1113:inblock in '
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:1105:in each'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:1105:in'
from :225:in require'
from <internal:gem_prelude>:225:inload_full_rubygems_library'
from :324:in const_missing'
from /usr/local/bin/gem:12:in'
Your backtrace indicates that you're running Bundler 0.8.1. Please uninstall it and make sure you have a more recent version of bundler installed :)