'require': no such file to load -- rails/cli (LoadError) - ruby-on-rails

when I uninstalled bundler 1.6.2 to use 1.0.0 rails crashed. I tried this command:
gem uninstall -i /home/mayukh/.rvm/gems/ruby-1.9.2-p320#global bundler -v=1.6.2
Please note, I have uninstalled this globally
Now, when I run rails -v or rails s it shows error like this:
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- rails/cli (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from /usr/bin/rails:7:in `<main>'
My ruby version is ruby 1.9.2p320 (2012-04-20 revision 35421) [x86_64-linux]
Is it the right way to use/uninstall bundler? or is there any way to switch between bundlers?
How to fix this issue and run rails again?

Uninstall bundle might not be the better solution. If you want to force the bundle version to install something try this (as said in this post) :
bundle _1.0.0_ install
But for you current problem, you should do what tadman said. Uninstall all bundle instances and get the lastest one to force the version after.
Hope this help !

Related

error `require' /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot

I installed ubuntu and want to install Ruby on Rails. But tried few times and see same error after I run 'rails new app' I see error
from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- bundler/setup (LoadError)
The server also doesn't run because of it.
You need to install Bundler first.
gem install bundler
Bundler is a Ruby gem. It's a Ruby gem used to manage other Ruby gems (often called dependencies).
can you try below command?
echo $GEM_PATH
and check the ruby version, Is that different version then ruby/2.5.0?
and if it's different then set your $GEM_PATH from below command.
SetEnv GEM_HOME /usr/lib/ruby/gems/1.8(set your path)
You need to use
gem install os

cannot load such file -- bundler (LoadError) in linode

I want to deploy rails app to linode cloud server. I installed ubuntu 14.04 LTS and installed ruby 2.3.0 by rvm and also installed passenger with apache2. Then I cloned my app from bitbucket and try to bundle on it but i can't. It says like this....
/usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- bundler (LoadError)
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/bin/bundle:7:in `<main>'
Actually I forgot to install rails. After installing rails it is resolved automatically.
gem install rails
You can simply recheck if you have ran
rvm use 'your ruby version'
then run
gem install bundler
that's it .
I think you don't have install bundler, I had almost precisely the same error, and was able to completely fix it simply by running:
gem install bundler
works for me :
bundle exec rake rails:update:bin
or, in RAILS 5+
rails app:update:bin

Cannot Create New Rails Project: `require': cannot load such file -- /config/boot (LoadError)

I am trying to create a new Rails project,
Jakes-Air:code JakeWengroff$ rails new MyNewProject -T
but I keep getting this error:
script/rails:5:in `require': cannot load such file -- /Users/JakeWengroff/config/boot (LoadError)
from script/rails:5:in `<main>'
Checking the Ruby version, ruby -v, I get
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
When I want to check the version of Rails, rails -v, I get the same error as when I want to initiate a new Rails proejct:
script/rails:5:in `require': cannot load such file -- /Users/JakeWengroff/config/boot (LoadError)
from script/rails:5:in `<main>'
So, I reinstalled Rails, gem install rails -v 4.2.0:
Successfully installed rails-4.2.0
Parsing documentation for rails-4.2.0
Done installing documentation for rails after 1 seconds
1 gem installed
I also did bundle install and bundle check and everything was fine. But the error persisted.
After reviewing some other, similar questions here, I thought it had to do with gemsets. From the RVM website, I decided to try rvm gemset create rails420, which gave me
ruby-2.1.2 - #gemset created /Users/JakeWengroff/.rvm/gems/ruby-2.1.2#rails420
ruby-2.1.2 - #generating rails420 wrappers..............
But then trying rails -v and rails new MyNewProject -T still threw the original error.
Any help is greatly appreciated.
Thank you in advance.
I had a similar issue, for me it turned out to be a problem with ruby. I have installed a different version of Ruby with RVM and installed the rails gem with this other version of Ruby.
rvm install 2.2.2
gem install rails
I would not recommend this solution as a sustainable one, but I couldn't solve this in a different way and at least it will get you going again.

Replacing RVM with rbenv --mkmf error

I was looking at replacing RVM with rbenv since I am using bundle to manage my gemfiles. rbenv, I believe, is a lot lighter in managing my Ruby versions, so I uninstalled RVM and installed rbenv. I installed the bundler gem using
gem install bundler
because we need it everywhere. Then I opened a project and installed the required version Ruby using rbenv:
rbenv install 1.9.3-p194
rbenv local 1.9.3-p194
rbenv rehash
I entered ruby -v to make sure it was using the right version of Ruby, and it was, so I tried running bundle and it ran until it tried to install RedCloth and and then failed:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb --with-cflags=-w
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:1:in `<main>'
It suggested that I install RedCoth before bundling, so I installed RedCloth:
gem install RedCloth
which succeeded. I then ran ruby -v, just to make sure it's still right, then tried running bundle update and the same error occured:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb --with-cflags=-w
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:1:in `<main>'
Gem files will remain installed in /home/ruberto/.bundler/tmp/7551/gems/RedCloth-4.2.9 for inspection.
Results logged to /home/ruberto/.bundler/tmp/7551/gems/RedCloth-4.2.9/ext/redcloth_scan/gem_make.out
An error occurred while installing RedCloth (4.2.9), and Bundler cannot continue.
Make sure that `gem install RedCloth -v '4.2.9'` succeeds before bundling.
I then tried installing a different version of Ruby but had no success there either.
Does anyone have ideas?
I subsequently tried doing the same thing in my other projects and it all seems to work just fine. I have one that uses 1.8.7 and it was as easy as setting the rbenv to the right version and then running bundle. I tried almost every combination of Ruby version and yet it's not working.
I had a similar problem. It turned out that, even though I had the ~/.rbenv/shims directory at the front of my path, zsh was caching the location of bundle to /usr/local/bin/bundle.
The solution was simply running rehash at the shell (not rbenv rehash). This flushed all the cached commands, including bundle, and all went well after that.
I finally overcame the problem.
I had installed a wrong version of Ruby 1.8.7-p370. I then ran bundle and that had some gems compiling the native extensions against Ruby 1.8.7 when the bundle was for a 1.9.3 package, so even if I was to switch over to the 1.9.3 version and try running bundle again it would bomb out.
To fix this, I simply removed all the gems and then installed the right version of Ruby and then re-ran bundle.

Error when trying to start server after upgrading to Rails 3

I've just upgraded to Rails 3, using the instructions from this railscast. When I try to start the server, this is what happens:
$ rails s
script/rails:6:in `require': no such file to load -- rails/commands (LoadError)
from script/rails:6:in `<main>'
I can't find this exact error using Google. Anyone know what is causing this? Thanks for reading
EDIT:
Here's the console output:
$ rvm 1.9.2
$ rails -v
Rails 3.0.1
$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]
$ rails new . -d sqlite3
(all the overwrite checking stuff happens here)
$ bundle install
...
Your bundle is complete! It was installed into /Users/ben/.rvm/gems/ruby-1.9.2-p0
$ rails s
script/rails:6:in `require': no such file to load -- rails/commands (LoadError)
from script/rails:6:in `<main>'
$ rvm list
rvm rubies
=> ruby-1.9.2-p0 [ x86_64 ]
$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]
$ rails -v
script/rails:6:in `require': no such file to load -- rails/commands (LoadError)
from script/rails:6:in `<main>'
Have you actually installed the rails 3.0.x gem? Maybe you missed this step :).
It looks like your script/rails script cannot find the included file from rails gem. You need to install all needed gems separately for each version of Ruby you're using (e.g. 1.8.7 and 1.9.2).
Maybe you can just reinstall your rubygem, or update it.
Rubygem versions should fit to your Ruby versions. For every Ruby version you installed separated Gems needed.
May I ask did you use any 'sudo' with RVM installations? Better to avoid, see here:
http://rvm.beginrescueend.com/rubies/rubygems/
Can you list here please your "gem list" after switched to default Ruby version you want to use? Also "rvm list" "ruby -v" "gem -v" and your OS please.
Also wise to write to forum at the section you downloaded Railscasts' video, because maybe others will have the same problem.

Resources