Bundle install gives LoadError - ruby-on-rails

I'm trying to install Canvas LMS. As I'm doing the production start for installing bundler and canvas dependencies I first run
sudo gem install bundler --version 2.2.19 --default
which executes successfully. Then I run
bundle _2.2.19_ install --path vendor/bundle
which gives the following error:
Traceback (most recent call last):
1: from /usr/local/bin/bundle:23:in `<main>'
/usr/local/bin/bundle:23:in `load': cannot load such file -- /usr/lib/ruby/gems/2.7.0/gems/bundler-2.2.19/exe/bundle (LoadError)
Here is what I get when I run gem env:
RubyGems Environment:
- RUBYGEMS VERSION: 3.1.2
- RUBY VERSION: 2.7.5 (2021-11-24 patchlevel 203) [x86_64-linux-gnu]
- INSTALLATION DIRECTORY: /var/lib/gems/2.7.0
- USER INSTALLATION DIRECTORY: /home/sam/.gem/ruby/2.7.0
- RUBY EXECUTABLE: /usr/bin/ruby2.7
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /home/sam/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /var/lib/gems/2.7.0
- /home/sam/.gem/ruby/2.7.0
- /usr/lib/ruby/gems/2.7.0
- /usr/share/rubygems-integration/2.7.0
- /usr/share/rubygems-integration/all
- /usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /home/sam/.nvm/versions/node/v16.16.0/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games
And running bundler -v gives me this result:
Bundler version 2.3.25
I'd appreciate any help to solve this load error.

Yep. I ran into the exact same issue but was able to fix with the below
sudo gem install bundler -v '2.2.19'
then
bundle _2.2.19_ install --path vendor/bundle
and was able to complete the installation successfully.
You may likely get an error at the end
An error occurred while installing idn-ruby (0.1.4), and Bundler cannot continue. Make sure that gem install idn-ruby -v '0.1.4'--source 'https://rubygems.org/' succeeds before bundling.
You can fix that by following the steps here
sudo apt-get install libldap2-dev libidn11-dev

Related

Pod Install: Ignoring ffi-1.13.1 because its extensions are not built. Try: gem pristine ffi --version 1.13.1

I tried running pod install in my Xcode project, but got the following error
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/dependency.rb:311:in `to_specs': Could not find 'ffi' (>= 1.3.0) among 84 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/Users/dylan/.gem/ruby/2.6.0:/Library/Ruby/Gems/2.6.0:/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0', execute `gem env` for more information
When I ran gem env, I got
RubyGems Environment:
- RUBYGEMS VERSION: 3.0.3
- RUBY VERSION: 2.6.3 (2019-04-16 patchlevel 62) [universal.x86_64-darwin20]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.6.0
- USER INSTALLATION DIRECTORY: /Users/dylan/.gem/ruby/2.6.0
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /Users/dylan/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-20
- GEM PATHS:
- /Library/Ruby/Gems/2.6.0
- /Users/dylan/.gem/ruby/2.6.0
- /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /Library/Apple/usr/bin
Everything was working before, one thing I did recently was updating Xcode to 12.3 and Big Sur. Not sure everyone else has this issue.
Got the same problem after updating to Big Sur
Reinstalling cocoapods works for me
gem install cocoapods
If you got the following error,
You might have to install separate package for the ruby development
environment, ruby-dev or ruby-devel for example.
install this
xcode-select --install
xcode-select --install
This is worked for me, before updating your pod please run the above line, then use your pod update or install

bash: bundle: command not found even though bundler is installed

I am hosting a Rails app on AWS EC2 instance and am deploying my application with Capistrano. During deployment I have been able to solve errors by installing missing tools like Monit. However, I'm stumped by this error: puma stderr: bash: bundle: command not found. I see bundler is installed on the server, but when i type bundle the terminal says Could not locate Gemfile. I have even tried reinstalling bundler gem install bundler but bundle command is still not recognized. I have listed details about my deployment target below. I'm not sure what to do and would appreciate any help.
gem environment returns:
RubyGems Environment:
- RUBYGEMS VERSION: 3.0.3
- RUBY VERSION: 2.6.5 (2019-10-01 patchlevel 114) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0
- USER INSTALLATION DIRECTORY: /home/ubuntu/.gem/ruby/2.6.0
- RUBY EXECUTABLE: /home/ubuntu/.rbenv/versions/2.6.5/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /home/ubuntu/.rbenv/versions/2.6.5/bin
- SPEC CACHE DIRECTORY: /home/ubuntu/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /home/ubuntu/.rbenv/versions/2.6.5/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0
- /home/ubuntu/.gem/ruby/2.6.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-document"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /home/ubuntu/.rbenv/versions/2.6.5/bin
- /home/ubuntu/.rbenv/libexec
- /home/ubuntu/.rbenv/plugins/ruby-build/bin
- /home/ubuntu/.rbenv/shims
- /home/ubuntu/.rbenv/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games
- /snap/bin
echo $PATH returns
/home/ubuntu/.rbenv/shims:/home/ubuntu/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
which gem returns
/home/ubuntu/.rbenv/shims/gem
locate bundle returns
/home/ubuntu/.gem/specs/rubygems.org%443/quick/Marshal.4.8/bundler-1.17.1.gemspec
/home/ubuntu/.rbenv/shims/bundle
/home/ubuntu/.rbenv/shims/bundler
/home/ubuntu/.rbenv/versions/2.6.5/bin/bundle
/home/ubuntu/.rbenv/versions/2.6.5/bin/bundler
/home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/2.6.0/bundler
/home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/2.6.0/bundler.rb
/home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/2.6.0/bundler/build_metadata.rb
/home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/2.6.0/bundler/capistrano.rb
/home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/2.6.0/bundler/cli
/home/ubuntu/.rbenv/versions/2.6.5/lib/ruby/2.6.0/bundler/cli.rb
...
Seems like some puma setting was overwritten. I added the following line to deploy.rb : set :rbenv_map_bins, %w{rake gem bundle ruby rails puma pumactl} to get past this error.
Link to the solution:
https://github.com/seuros/capistrano-puma/issues/206
If you use bundler, you should add capistrano-bundler. See GitHub issue

Bunder is installing with rubygems dependency not version in gem directory

I'm using rbenv to manage my Rubies. Heroku seems to only (or at least prefer) Bundler v1.15.2 according to their Ruby Support docs.
So I:
$ bundle exec gem install bundler -v 1.15.2
and that's the only version of Bundler in Ruby 2.4.4's gem directory.
However when I bundle install or bundle update the Gemfile.lock says:
BUNDLED WITH
1.16.2
And that gives me warnings in deployment (Heroku) and even locally every time I bundle update <some_gem>.
I did update rubygems recently:
$ gem -v
2.6.14.1
$ gem update --system
Updating rubygems-update
Fetching: rubygems-update-2.7.7.gem (100%)
Successfully installed rubygems-update-2.7.7
Installing RubyGems 2.7.7
Bundler 1.16.2 installed
RubyGems 2.7.7 installed
Regenerating binstubs
Which explains why bundler 1.16.2 is on my system but how can I force it to source the version in Ruby's directory and put an end to all these warnings:
Warning: the running version of Bundler (1.15.2) is older than the
version that created the lockfile (1.16.2). We suggest you upgrade to
the latest version of Bundler by running gem install bundler.
Edit: gem env as per request
RubyGems Environment:
- RUBYGEMS VERSION: 2.7.7
- RUBY VERSION: 2.4.4 (2018-03-28 patchlevel 296) [x86_64-darwin18]
- INSTALLATION DIRECTORY: /Users/meltemi/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0
- USER INSTALLATION DIRECTORY: /Users/meltemi/.gem/ruby/2.4.0
- RUBY EXECUTABLE: /Users/meltemi/.rbenv/versions/2.4.4/bin/ruby
- EXECUTABLE DIRECTORY: /Users/meltemi/.rbenv/versions/2.4.4/bin
- SPEC CACHE DIRECTORY: /Users/meltemi/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/meltemi/.rbenv/versions/2.4.4/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-18
- GEM PATHS:
- /Users/meltemi/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0
- /Users/meltemi/.gem/ruby/2.4.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-document"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/meltemi/.rbenv/versions/2.4.4/bin
- /usr/local/Cellar/rbenv/1.1.1/libexec
- /Users/meltemi/.rbenv/shims
- /usr/local/heroku/bin
- .git/safe/../../bin
- /Users/meltemi/.bin
- /usr/local/sbin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /opt/X11/bin

I can't run bundle it show bundle: command not found

I install bundle by using
sudo bundle install and sudo gem install bundler
It show error
bundle: command not found
I set path like this.
export PATH=$PATH:/var/lib/gems/1.8/bin
When I run command gem environment it show like this.
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.8
- RUBY VERSION: 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8
- USER INSTALLATION DIRECTORY: /root/.gem/ruby/1.8
- RUBY EXECUTABLE: /usr/bin/ruby1.8
- EXECUTABLE DIRECTORY: /usr/bin
- SPEC CACHE DIRECTORY: /root/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/lib/ruby/gems/1.8
- /root/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-rdoc --no-ri"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
When I run command echo $PATH it show like this.
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
How to fix error bundle: command not found ?
Simply hit the command
$gem install bundle
if the ruby version is required to updated do it separately
bundle(r) is a gem. I am guessing you have the gem not installed yet.
try
gem install bundler
Well, you're trying to install ruby as system package, and I would suggest not doing that since ruby 1.8 is very old version.
You should use rvm or rbenv instead for ruby installation.
Take a look on http://rvm.io. After rvm installed, install ruby
rvm install 2.3.1
then install bundler
gem install bundler

RubyMine Using Incorrect/Different Ruby Version - Ubuntu

I'm on an Ubuntu system and have installed ruby-2.1.3 using rbenv. I have made 2.1.3 global and it is accessible from my system terminal.
System Terminal:
lambda#lambda-PC:~$ ruby -v
ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-linux]
However, when I run the same command in my RubyMine embedded terminal, it asks me to install ruby through the aptitude repository.
lamdba#lambda-PC:~/RubymineProjects/Loccasions$ ruby -v
The program 'ruby' can be found in the following packages:
* ruby
* ruby1.8
Try: sudo apt-get install <selected package>
The same thing goes for "gem environment" and "gem -v".
System Terminal:
lambda#lambda-PC:~$ gem -v
2.4.2
lambda#lambda-PC:~$ gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.2
- RUBY VERSION: 2.1.3 (2014-09-19 patchlevel 242) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/lambda/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0
- RUBY EXECUTABLE: /home/lambda/.rbenv/versions/2.1.3/bin/ruby
- EXECUTABLE DIRECTORY: /home/lambda/.rbenv/versions/2.1.3/bin
- SPEC CACHE DIRECTORY: /home/lambda/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /home/lambda/.rbenv/versions/2.1.3/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/lambda/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0
- /home/lambda/.gem/ruby/2.1.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /home/lambda/.rbenv/versions/2.1.3/bin
- /home/lambda/.rbenv/libexec
- /home/lambda/.rbenv/plugins/ruby-build/bin
- /home/lambda/.rbenv/shims
- /home/lambda/.rbenv/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games
RubyMine Terminal:
lambda#lambda-PC:~/RubymineProjects/Loccasions$ gem -v
The program 'gem' can be found in the following packages:
* ruby
* rubygems
Try: sudo apt-get install <selected package>
lambda#lambda-PC:~/RubymineProjects/Loccasions$ gem environment
The program 'gem' can be found in the following packages:
* ruby
* rubygems
Try: sudo apt-get install <selected package>
I have sifted through all of the settings that I'm aware of in RubyMine that relate to the SDK, and have directed them the ruby-2.1.3 stored in rbenv. I have done much research on this topic, but my attempts are futile. I would appreciate help in diagnosing this error.
I added $HOME/.rbenv/shims to my path through
export PATH="$HOME/.rbenv/shims:$PATH"
And it works!

Resources