Bundler failing to install - ruby

I am trying to update bundler in a project. i updated rbenv ruby 2.6.6. Then i ran bundle install and nothing happened. I followed the instructions in the error msg. Programme runs and then times out.
git:(master) ruby -v
ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-darwin18]
git:(master) bundler -v
Traceback (most recent call last):
2: from /Users/maryhealy/.rbenv/versions/2.6.6/bin/bundler:23:in `<main>'
1: from /Users/maryhealy/.rbenv/versions/2.6.6/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path'
/Users/maryhealy/.rbenv/versions/2.6.6/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': Could not find 'bundler' (2.1.4) required by your /Users/maryhealy/code_old/yance/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.1.4`
git:(master) gem install bundler
^CERROR: Interrupted
git:(master) gem install bundler:2.1.4
^CERROR: Interrupted
I tried running this in project directory
gem install bundler -v '~> 2.1'
ERROR: Loading command: install (LoadError)
dlopen(/Users/maryhealy/.rbenv/versions/2.4.4/lib/ruby/2.4.0/x86_64-darwin17/openssl.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
Referenced from: /Users/maryhealy/.rbenv/versions/2.4.4/lib/ruby/2.4.0/x86_64-darwin17/openssl.bundle
Reason: image not found - /Users/maryhealy/.rbenv/versions/2.4.4/lib/ruby/2.4.0/x86_64-darwin17/openssl.bundle
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
I have old versions of ruby as per my gem env
➜ ~ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.14.1
- RUBY VERSION: 2.4.4 (2018-03-28 patchlevel 296) [x86_64-darwin17]
- INSTALLATION DIRECTORY: /Users/maryhealy/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0
- USER INSTALLATION DIRECTORY: /Users/maryhealy/.gem/ruby/2.4.0
- RUBY EXECUTABLE: /Users/maryhealy/.rbenv/versions/2.4.4/bin/ruby
- EXECUTABLE DIRECTORY: /Users/maryhealy/.rbenv/versions/2.4.4/bin
- SPEC CACHE DIRECTORY: /Users/maryhealy/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/maryhealy/.rbenv/versions/2.4.4/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-17
- GEM PATHS:
- /Users/maryhealy/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0
- /Users/maryhealy/.gem/ruby/2.4.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/maryhealy/.rbenv/versions/2.4.4/bin
- /usr/local/Cellar/rbenv/1.1.2/libexec
- ./bin
- ./node_modules/.bin
- /Users/maryhealy/.rbenv/shims
- /Users/maryhealy/.rbenv/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /Users/maryhealy/.composer/vendor/bin
- /usr/local/sbin
i have no idea how to fix the problem to update bundler. Any help appreciated?

Installing bundler
You need to install Bundler globally, not only for the current project (in the project directory). This is because Bundler provides a consistent environment for Ruby projects by tracking and installing the exact gems and versions that are needed.
Open a terminal and write
gem install bundler
You can check if the installation is successful by writing
bundle -v

Related

Installation messed up with Ruby: Unable to install jekyll

I was trying to setup a GitHub Page using Jekyll, which rely on Ruby (like here). Unfortunately, I think I kind of messed up with the installation (after a few sudo apt-get install ruby-full and sudo apt-get remove ruby-full ...)
Right now, I am stuck with an old version of Ruby (I think) on my computer that I am not able to update. Here is the state of my system right now:
$ ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu]
$ gem -v
3.1.2
$ gem install jekyll
ERROR: Error installing jekyll:
The last version of sass-embedded (~> 1.54) to support your Ruby & RubyGems was 1.58.0. Try installing it with `gem install sass-embedded -v 1.58.0` and then running the current command again
sass-embedded requires RubyGems version >= 3.3.22. The current RubyGems version is 3.1.2. Try 'gem update --system' to update RubyGems itself.
$ gem update --system
Updating rubygems-update
Successfully installed rubygems-update-3.4.6
Parsing documentation for rubygems-update-3.4.6
Done installing documentation for rubygems-update after 0 seconds
Parsing documentation for rubygems-update-3.4.6
Done installing documentation for rubygems-update after 0 seconds
Installing RubyGems 3.4.6
Traceback (most recent call last):
5: from setup.rb:22:in `<main>'
4: from setup.rb:22:in `require'
3: from /home/jarret/gems/gems/rubygems-update-3.4.6/lib/rubygems.rb:1332:in `<top (required)>'
2: from /home/jarret/gems/gems/rubygems-update-3.4.6/lib/rubygems.rb:1332:in `require'
1: from /usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:49:in `<top (required)>'
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:50:in `<class:Specification>': undefined method `rubyforge_project=' for class `Gem::Specification' (NameError)
3: from setup.rb:22:in `<main>'
2: from setup.rb:22:in `require'
1: from /home/jarret/gems/gems/rubygems-update-3.4.6/lib/rubygems.rb:1328:in `<top (required)>'
/home/jarret/gems/gems/rubygems-update-3.4.6/lib/rubygems.rb:1342:in `rescue in <top (required)>': undefined method `rubyforge_project=' for class `Gem::Specification' (NameError)
Loading the /usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb file caused an error. This file is owned by your OS, not by rubygems upstream. Please find out which OS package this file belongs to and follow the guidelines from your OS to report the problem and ask for help.
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 3.1.2
- RUBY VERSION: 2.7.0 (2019-12-25 patchlevel 0) [x86_64-linux-gnu]
- INSTALLATION DIRECTORY: /home/jarret/gems
- USER INSTALLATION DIRECTORY: /home/jarret/.gem/ruby/2.7.0
- RUBY EXECUTABLE: /usr/bin/ruby2.7
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /home/jarret/gems/bin
- SPEC CACHE DIRECTORY: /home/jarret/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/jarret/gems
- /home/jarret/.gem/ruby/2.7.0
- /var/lib/gems/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/jarret/gems/bin
- /home/jarret/miniconda3/condabin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games
- /snap/bin
- /opt/fiji/Fiji.app
I've tried many remove/install, I've tried updated gem, ruby. Nothing unlocked me so far.
Try to replace ruby3.0, sass1.58 is too advanced and may not be compatible with ruby2.7.
Please follow these steps and run the command.
rvm install 3.0
rvm use 3.0.0 -default
rvm -v
rvm gemset update
gem install jekyll
jekyll -v

bundle install using old rubygems version

I'm having what appears to be the exact same problem seen in a 1-month old question that no one has touched. I installed rbenv using homebrew, installed ruby 2.3.1 using rbenv install 2.3.1, installed jekyll and bundler using gem install jekyll and gem install bundler, then within a jekyll project, I typed bundle install. I got the error Rubygems 2.0.14.1 is not threadsafe, so your gems will be installed one at a time. Upgrade to Rubygems 2.1.0 or higher to enable parallel gem installation. When I run gem env, I see this:
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.6
- RUBY VERSION: 2.3.1 (2016-04-26 patchlevel 112) [x86_64-darwin15]
- INSTALLATION DIRECTORY: /Users/lindsb/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0
- USER INSTALLATION DIRECTORY: /Users/lindsb/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /Users/lindsb/.rbenv/versions/2.3.1/bin/ruby
- EXECUTABLE DIRECTORY: /Users/lindsb/.rbenv/versions/2.3.1/bin
- SPEC CACHE DIRECTORY: /Users/lindsb/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/lindsb/.rbenv/versions/2.3.1/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-15
- GEM PATHS:
- /Users/lindsb/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0
- /Users/lindsb/.gem/ruby/2.3.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/lindsb/.rbenv/versions/2.3.1/bin
- /usr/local/Cellar/rbenv/1.0.0/libexec
- /Users/lindsb/.local/bin
- /usr/local/sbin
- /usr/local/bin
- /Users/lindsb/.rbenv/shims
- /Users/lindsb/.local/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /opt/X11/bin
- /Library/TeX/texbin
I don't understand why bundler complains about Rubygems being below 2.1.0 when my Rubygems version is 2.6.6.
There is a Gemfile and a Gemfile.lock in the project directory. Gemfile looks like this:
source 'https://rubygems.org'
# jekyll
gem "jekyll", "3.1.1"
gem "redcarpet"
# compiling less
gem 'therubyracer'
gem 'less'
# minifying
gem 'jekyll-press'
# octokit
gem 'octokit'
gem 'netrc'
Hi I am learing Rails and encountered the same issue and I don't know what the root cause it is. But when I try reinstall bundler again
gem install bundler
and then run
bundle install
everything goes fine now.
I don't know exactly what the issue was, but when I removed Gemfile.lock and reran bundle install everything worked fine. There were probably just some bad constraints or something in Gemfile.lock.

How to fix rubygem not found after successful installation?

I have installed the rubygems-mirror gem (successfully it would seem), but when I execute the gem I get the following error:
$ gem mirror
ERROR: Install the rubygems-mirror gem for the mirror command
EDIT: The installation was done using a gem install command, and I have setup the ~/.gem/.mirrorrc file as a cut/paste from the gem documentation, save the target directory.
Both doing an listing of ~/.gems/ruby/gems and running gem list show I have rubygems-mirror version 1.1.0 on my system. Here is my gem list:
$ gem list rubygems-mirror
*** LOCAL GEMS ***
rubygems-mirror (1.1.0)
$ ls ~/.gem/ruby/gems/rubygems-mirror-1.1.0
CHANGELOG.rdoc lib Manifest.txt Rakefile README.rdoc test
And here is my gem environment:
$ gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.14
- RUBY VERSION: 2.0.0 (2014-11-13 patchlevel 598) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/localadm/.gem/ruby
- RUBY EXECUTABLE: /usr/bin/ruby
- EXECUTABLE DIRECTORY: /home/localadm/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/localadm/.gem/ruby
- /usr/share/gems
- /usr/local/share/gems
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
I've never had such an issue with a gem before, I'm a little confused at what to do here. To make things even more confusing, I can run gem mirror --help and receive the correct help text for the mirror gem as output.
UPDATE: It seems I am able to use a work-around. I have cloned the git source repo, and seem to be able to execute $ rake mirror:update successfully. I'm sitting at about 2000/819236 gems downloaded, but so far so good.
Still would like to figure out how I can run the mirror simply with $ gem mirror as it should work.

public_suffix not getting installed while running bundle install jekyll github-pages

I have a blog of mine in jekyll and I want to publish it on github-pages.
Taking reference from here:
https://help.github.com/articles/using-jekyll-with-pages.
but I am getting this error while running bundle install
Gem::InstallError: public_suffix requires Ruby version >= 2.0.
An error occurred while installing public_suffix (1.5.1), and Bundler cannot continue.
Make sure that `gem install public_suffix -v '1.5.1'` succeeds before bundling.
below is the details of my gem env
gem env :
RubyGems Environment:
- RUBYGEMS VERSION: 2.2.3
- RUBY VERSION: 2.1.6 (2015-04-13 patchlevel 336) [x86_64-linux-gnu]
- INSTALLATION DIRECTORY: /var/lib/gems/2.1.0
- RUBY EXECUTABLE: /usr/bin/ruby2.1
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /home/ashwin/.gem/specs
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /var/lib/gems/2.1.0
- /home/ashwin/.gem/ruby/2.1.0
- /usr/share/rubygems-integration/2.1.0
- /usr/share/rubygems-integration/2.1
- /usr/share/rubygems-integration/all
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/heroku/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games
Just like you my ruby version was correct, but the fix for me was reinstalling bundler.
sudo gem install bundler
Try installing without sudo.
I've had the same issue after upgrading Ruby to 2.2.3 with rbenv (which is installed without admin rights).
After having upgraded, I ran sudo gem install github-pages, which resulted in the above error. Running gem install github-pages worked just fine.
Then, trying to have Jekyll serve my page, I ran bundle exec jekyll serve, which told that there were some bundles missing. bundle install fixed that too, and bundle exec jekyll serve worked fine.
Make sure that gem install public_suffix -v '1.5.1' succeeds before bundling.
I had the same issue and this command solves it.
sudo gem install github-pages -v 33
Then run jekyll.
bundle exec jekyll serve
See here
In the past i've also had issues with installing github pages or Jekyll dependencies because there is a space somewhere in the full path to your project folder and apparrently some of the dependencies cant handle spaces in filenames.
Most recently this seems to have been happening to me with public_suffix version 4.0.5 where a space in my username causes it to break
This has also happened with http_parser

gem command silently does nothing

I need to use Twitter's twurl command. In so doing I have installed Ruby and then Gem under Linux.
I've downloaded the latest version of twurl but when I attempt to use it to do an install it silently does nothing. I've also tried installing the oauth gem, but the same result. Gem must work because I can do a build using the gemspec file and it creates a gem file.
cam:~/twurl-master$ sudo gem build twurl.gemspec
sh: git: command not found
/usr/local/lib/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:55: command not found: git ls-files
sh: git: command not found
WARNING: description and summary are identical
WARNING: See http://guides.rubygems.org/specification-reference/ for help
Successfully built RubyGem
Name: twurl
Version: 0.9.2
File: twurl-0.9.2.gem
cam:~/twurl-master$ ls
COPYING Gemfile INSTALL README Rakefile bin lib test twurl-0.9.2.gem twurl.gemspec
cam:~/twurl-master$ sudo gem install twurl
cam:~/twurl-master$ sudo gem install twurl --remote
cam:~/twurl-master$ sudo gem list t
*** LOCAL GEMS ***
cam:~/twurl-master$ sudo gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.2.2
- RUBY VERSION: 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
- INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8
- RUBY EXECUTABLE: /usr/bin/ruby1.8
- EXECUTABLE DIRECTORY: /usr/bin
- SPEC CACHE DIRECTORY: /home/cam/.gem/specs
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /usr/lib/ruby/gems/1.8
- /home/cam/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/X11R6/bin
cam:~/twurl-master$
I am at a loss as to know what to do. I've searched on Google but nobody else seems to have this particular problem. No error message is highly unhelpful...
I'm not sure what is the issue and if that's related, but just in case, twurl gem also requires the gem oauth-0.4.7.

Resources