cannot load such file -- bundler (LoadError) in linode - ruby-on-rails

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

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

Ruby on Rails Bundler issues LoadError

I believe I am having some PATH issues for my gems.
I am using rvm (version 1.29.3) with ruby (version 2.4.1) and rails (version 5.1.4)
I tried to run rails new myapp to which I get the following LoadErrors:
remove config/initializers/new_framework_defaults_5_1.rb
run bundle install
/Users/fabienbessez/.rvm/rubies/ruby-2.4.1/bin/ruby: No such file or directory
-- /Users/fabienbessez/.rvm/rubies/ruby-
2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/exe/bundle (LoadError)
run bundle exec spring binstub --all
/Users/fabienbessez/.rvm/rubies/ruby-2.4.1/bin/ruby: No such file or directory
-- /Users/fabienbessez/.rvm/rubies/ruby
2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/exe/bundle (LoadError)
I get the same error when I try to then run bundle install
I checked the contents of ~/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems to which I found that bundler-1.15.4 but not bundler-1.16.0. I assume that that is the issue. But I can't figure out how to update those gems. gem install bundler says it has installed bundler 1.16.0 but this is not being updated.
Any ideas??
Thanks!
Have you tried to uninstall all old versions of bundler with gem uninstall bundler?

LoadError: cannot load such file -- bcrypt_ext on Windows 2008 x64 server

I upgraded my environment from Ruby 2.0.0 to 2.2.3.
I also upgraded (overwrite) DevKit, and re-run ruby dk.rb install.
I removed Gemfile.lock and ran bundle install to start with a brand new environment. Everything looks ok, but I get the error:
E:\Projects\development\Stairs>rake db:migrate
rake aborted!
LoadError: cannot load such file -- bcrypt_ext
E:/Projects/development/Stairs/config/application.rb:7:in `<top (required)>'
E:/Projects/development/Stairs/Rakefile:4:in `<top (required)>'
LoadError: cannot load such file -- 2.2/bcrypt_ext
E:/Projects/development/Stairs/config/application.rb:7:in `<top (required)>'
E:/Projects/development/Stairs/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
I first had the same issue with Nokogiri, which I solved using this solution : Nokogiri load error
using Juloi Elixir's solution and installing Nokogiri from a local copy.
But I don't feel like doing this foreach gem! It looks like ruby is searching the gem using a ./ or ./2.2 path, while gems are stored in a ./2.2.0 path. Is this configurable?
How can I solve this issue?
Note: Gemfile contains gem 'bcrypt', '~> 3.1.10'
Thanks!
I spent an entire hour fixing this, just now.
Well what I did was I followed some advice online to do a
gem install bcrypt --platform=ruby
And then, it worked in irb.
irb(main):001:0> require 'bcrypt'
=> true
Later when I had to do a bundle install, for some odd reason rails installed another bcrypt and the error was back. So I had two folders in my gem root.
bcrypt-3.1.10
bcrypt-3.1.10-x64-mingw32
So, since the first folder was the one that got built with the devkit, and it works. I deleted the contents of the second folder and copied the contents of the first into it.
Seems to be working as I'm writing this.
Solution was here: bcrypt-ruby#github:
Rebuild locally the bcrypt gem:
Change to the gem directory \Ruby22-x64\lib\ruby\gems\2.2.0\gems\bcrypt-3.1.10-x64-mingw32\ext\mri>
Run ruby extconf.rb
Run make
Run make install
Note that this works only if your DevKit environment is correctly setup (run devkitvars.bat).
#user1185081 's solution worked for me in a windows machine. I ran following commands and worked like magic:
$ cd C:\RailsInstaller\Ruby2.2.0\lib\ruby\gems\2.2.0\gems\bcrypt-3.1.10-x86-mingw32\ext\mri
$ ruby extconf.rb
$ C:\<DevKit Path>\devkitvars.bat (assuming you have devkit installed)(Ran this instead of running "make" because it was not recognized as an internal or external command)
$ make install
What worked for me on Windows 7:
gem uninstall bcrypt to uninstall all versions of bcrypt, including those listed as dependencies
gem install bcrypt to reinstall
bundle install
In my case, a designating of the old version to bcrypt in Gemfile was a cause of the error. I removed a designating of the version and run bundle update bcrypt, then it was settled.
Here is the solution worked for me:
C:\> gem uninstall brcypt
C:\> gem install --no-ri --no-rdoc bcrypt
C:\> cd (path to gems root)\bcrypt-3.1.7-x86-mingw32\ext\mri
C:\(path to gems root)\bcrypt-3.1.7-x86-mingw32\ext\mri> ruby extconf.rb
C:\(path to gems root)\bcrypt-3.1.7-x86-mingw32\ext\mri> make
C:\(path to gems root)\bcrypt-3.1.7-x86-mingw32\ext\mri> make install
I had the same problem:
cannot load such file — bcrypt_ext
Windows 8.1 64bit
ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32]
Rails 5.1.4
My solution:
gem uninstall bcrypt-ruby
gem uninstall bcrypt
gem install bcrypt –platform=ruby
added this whole line to Gemfile:
gem 'bcrypt', git: 'https://github.com/codahale/bcrypt-ruby.git', :require => 'bcrypt'
bundle install
This works for me, add this to your gems file:
gem 'bcrypt', '~> 3.1.7', platform: :ruby
This process is for windows:
The problem is with the programs installed on the system.
Uninstall all rails programs:
All Ruby programs.
RailsInstaller.
Removes all files that have been able to uninstall, you have to do it manually inside:
C:\RailsInstaller
Install de ruby version 2.2 from:
http://railsinstaller.org/en
Wait a moment and it's already to go.
MarlonJon.es

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.

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

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 !

Resources