Error installing Jekyll, requires Ruby >= 2.0.0 - ruby

I get the error
Error installing jekyll:
jekyll requires Ruby version >= 2.0.0.
when I run
sudo gem install jekyll
"ruby -v" says I have ruby version 1.9.3
How do I install Jekyll? Do I need to upgrade ruby? If so, how?
Update - I installed ruby 2.0.0 with rvm but get the same error. Since trying to install with gem, could that still be trying to install with the older version of ruby? If so, how to find and change?

Try
sudo gem install jekyll -v 2.5
The default command apparently tries to install Jekyll 3, which was released on October 27th 2015. The 2.5 version still works with Ruby 1.9.3, and its quite allright for me, probably for you too.

I solved this issue the following way (assuming the ruby2.0 package is installed):
sudo rm /usr/bin/ruby
sudo rm /usr/bin/gem
sudo ln -s /usr/bin/ruby2.0 /usr/bin/ruby
sudo ln -s /usr/bin/gem2.0 /usr/bin/gem
Quick explanation:
/usr/bin/ruby and /usr/bin/gem are symlinks, you can check their target by entering:
ll /usr/bin/ruby
ll /usr/bin/gem
Changing the target of these links results in changing your default ruby and gem execution. Switching to version 2.0 for instance, lets you install Jekyll 3.

You can give a try to:
sudo apt-get install ruby2.0 ruby2.0-dev
sudo gem2.0 install jekyll-import

I try the following on Ubuntu 14.04:
sudo apt-get install ruby2.0 ruby2.0-dev
sudo apt-get install zlib1g-dev
sudo gem2.0 install jekyll

If you've already installed a later version of Ruby AND you're using rbenv, and gem gives the same error, it is because you are still using the old version of gem. There are now two executables called gem in your filesystem. Figure out which gem is the default with "which":
$ which gem
If you see something like */.rbenv/shims/gem, this is not the version of gems that you want to use. The correct version of gem will be in /.rbenv/versions/[your preferred version, i.e. 2.0.0]. You can run that version of gem by including the full path to the executable:
$ sudo /path/to/correct/gem install jekyll

Related

Cannot install jekyll as it complaints: 'requires Ruby version >= 2.3.0'

I have only one ruby version installed:
$ rvm list
=* ruby-2.5.7 [ x86_64 ]
# => - current
# =* - current && default
# * - default
But any time I install jekyll or bundler I got complain of an older version.
$ sudo gem install bundler
ERROR: Error installing bundler:
bundler requires Ruby version >= 2.3.0.
Unable to find the reason.
Operating system: CentOS
When using RVM as your Ruby manager you do not (and should not) use sudo. Sudo runs everything under the root account. But RVM is installed under your own user account, and therefore sudo is not needed, and will in fact circumvent RVM if used.
So, just drop the sudo part, and if RVM is installed properly, everything should start working correctly:
gem install bundler # <- no sudo needed
I bit late, but I had the same problem and couldn't find an answer documented anywhere.
The problem is that sudo uses a different version of ruby than what rvm has set. You can see this by comparing ruby -v and sudo ruby -v.
To solve this, try rvmsudo gem install bundler. This causes sudo to use the version of ruby that rvm expects.
Read more here: https://rvm.io/integration/sudo

Trying to install bro pages: mime-types requires Ruby version >= 1.9.2

I've been trying to install bro pages, but I'm hitting a wall.
I've managed to upgrade to Ruby 2.1.0:
craig#Craig-loaf:~$ ruby -v
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]
craig#Craig-loaf:~$ gem -v
2.2.1
But I try to install bro pages, like so:
craig#Craig-loaf:~$ sudo gem install bropages
ERROR: Error installing bropages:
mime-types requires Ruby version >= 1.9.2.
Which to me makes no sense.
I found some where on Stackoverflow a similar problem, where another gem had issues with being installed at they recommended adding --pre --no-ri --no-rdoc to the end, but I get this error instead:
craig#Craig-loaf:~$ sudo gem install bropages --pre --no-ri --no-rdoc
[sudo] password for craig:
ERROR: Could not find a valid gem 'bropages' (>= 0) in any repository
ERROR: Possible alternatives: bropages
craig#Craig-loaf:~$ sudo gem install mime-types --pre --no-ri --no-rdoc
ERROR: Could not find a valid gem 'mime-types' (>= 0) in any repository
ERROR: Possible alternatives: mime-types
So how can I get round this, and install bropages?
Is the sudo user set up to use a different ruby version (or any ruby version at all)? I've seen this happen before on UNIX machines where the main user is configured but the sudo user isn't. For example, the way I have things set up right now, > gem install {something} works fine, but > sudo gem install {something} claims it can't find the 'gem' command.
You might also try running without sudo. I don't sudo on my Linux machine, and I'm pretty sure my Mac doesn't require me to, either.
Try running 'sudo ruby -v' and 'sudo gem -v'. If that doesn't give you what you need to solve the issue, post the output to those commands here on the thread.
I got the above mentioned errors as well
I'm using Ubuntu 12.10 64bit.
bropages requires Ruby version 1.9.2, I had 1.8.7 installed. What fixed it for me is to install the latest version of ruby and install bropages gem in that so I could use it.
Here are the steps I took to install the latest version, and specify that as the one to use and to install bropages in that.
sudo apt-get update
sudo apt-get install curl
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements
rvm install ruby
rvm use ruby --default
rvm rubygems current
gem install rails
gem install bropages
Then finally I can use is like this:
bro curl
9 entries for curl -- submit your own example with "bro add curl"
# get the contents of a web page
curl http://bropages.org
bro thanks to upvote (22)
bro ...no to downvote (2)
Source: https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-ubuntu-12-04-lts-precise-pangolin-with-rvm
And http://bropages.org/

Ruby: How to install a specific version of a ruby gem?

Using the command-line gem tool, how can I install a specific version of a gem?
Use the -v flag:
$ gem install fog -v 1.8
Use the --version parameter (shortcut -v):
$ gem install rails -v 0.14.1
…
Successfully installed rails-0.14.1
You can also use version comparators like >= or ~>
$ gem install rails -v '~> 0.14.0'
…
Successfully installed rails-0.14.4
With newer versions of rubygems you can tighten up your requirements:
$ gem install rails -v '~> 0.14.0, < 0.14.4'
…
Successfully installed rails-0.14.3
Since some time now you can also specify versions of multiple gems:
$ gem install rails:0.14.4 rubyzip:'< 1'
…
Successfully installed rails-0.14.4
Successfully installed rubyzip-0.9.9
But this doesn't work for more than one comparator per gem (yet).
For installing
gem install gemname -v versionnumber
For uninstall
gem uninstall gemname -v versionnumber
for Ruby 1.9+ use colon.
gem install sinatra:1.4.4 prawn:0.13.0
As others have noted, in general use the -v flag for the gem install command.
If you're developing a gem locally, after cutting a gem from your gemspec:
$ gem install gemname-version.gem
Assuming version 0.8, it would look like this:
$ gem install gemname-0.8.gem
You can use the -v or --version flag. For example
gem install bitclock -v '< 0.0.2'
To specify upper AND lower version boundaries you can specify the --version flag twice
gem install bitclock -v '>= 0.0.1' -v '< 0.0.2'
or use the syntax (for example)
gem install bitclock -v '>= 0.0.1, < 0.0.2'
The other way to do it is
gem install bitclock:'>= 0.0.1'
but with the last option it is not possible to specify upper and lower bounderies simultaneously.
[gem 3.0.3 and ruby 2.6.6]
Linux
To install different version of ruby, check the latest version of package using apt as below:
$ apt-cache madison ruby
ruby | 1:1.9.3 | http://ftp.uk.debian.org/debian/ wheezy/main amd64 Packages
ruby | 4.5 | http://ftp.uk.debian.org/debian/ squeeze/main amd64 Packages
Then install it:
$ sudo apt-get install ruby=1:1.9.3
To check what's the current version, run:
$ gem --version # Check for the current user.
$ sudo gem --version # Check globally.
If the version is still old, you may try to switch the version to new by using ruby version manager (rvm) by:
rvm 1.9.3
Note: You may prefix it by sudo if rvm was installed globally. Or run /usr/local/rvm/scripts/rvm if your command rvm is not in your global PATH. If rvm installation process failed, see the troubleshooting section.
Troubleshooting:
If you still have the old version, you may try to install rvm (ruby version manager) via:
sudo apt-get install curl # Install curl first
curl -sSL https://get.rvm.io | bash -s stable --ruby # Install only for the user.
#or:# curl -sSL https://get.rvm.io | sudo bash -s stable --ruby # Install globally.
then if installed locally (only for current user), load rvm via:
source /usr/local/rvm/scripts/rvm; rvm 1.9.3
if globally (for all users), then:
sudo bash -c "source /usr/local/rvm/scripts/rvm; rvm 1.9.3"
if you still having problem with the new ruby version, try to install it by rvm via:
source /usr/local/rvm/scripts/rvm && rvm install ruby-1.9.3 # Locally.
sudo bash -c "source /usr/local/rvm/scripts/rvm && rvm install ruby-1.9.3" # Globally.
if you'd like to install some gems globally and you have rvm already installed, you may try:
rvmsudo gem install [gemname]
instead of:
gem install [gemname] # or:
sudo gem install [gemname]
Note: It's prefered to NOT use sudo to work with RVM gems. When you do
sudo you are running commands as root, another user in another shell
and hence all of the setup that RVM has done for you is ignored while
the command runs under sudo (such things as GEM_HOME, etc...). So to
reiterate, as soon as you 'sudo' you are running as the root system
user which will clear out your environment as well as any files it
creates are not able to be modified by your user and will result in
strange things happening.
Prior to installing, you can check the available versions with the list command.
gem list ^[gemname]$ --remote --all
gem install [gemname] -v [version]

how to update gem command in ubuntu?

my gem version is 1.3.5 and I can't install certain gems because of that.I tried to update the gem on my computer by
sudo update --system
and it gives me an error
ERROR: While executing gem ... (RuntimeError)
gem update --system is disabled on Debian.
RubyGems can be updated using the official
Debian repositories by aptitude or apt-get.
so according to some people, the source need to be downloads and it needs to executed by ruby. i downloaded the file, did
sudo ruby setup.rb
and it gave me
RubyGems 1.8.24 installed
== 1.8.24 / 2012-04-27
1 bug fix:
Install the .pem files properly. Fixes #320
Remove OpenSSL dependency from the http code path
RubyGems installed the following executables:
/usr/bin/gem1.8
but when I hit ruby gem -v it still gives me 1.3.5 rather than the one I installed which is 1.8.
Do I need to uninstall the older version manually? or some other thing I need to do first?
RubyGems installed the following executables: /usr/bin/gem1.8
As the line says, the name of the program is gem1.8, not gem. Ergo, you need to call
gem1.8 -v
not
gem -v
Please try make a symbolic link.
sudo ln -s /usr/bin/gem1.8 /usr/bin/gem

json_pure/rubygems cyclic dependencies

I have an issue when trying to set up rvm, where gems weren't installing due to them being dependent on json_pure. I tried to install json_pure, but rubygems itself seems to depend on json_pure. I have tried removing all versions of json_pure, but rubygems still complains.
$ sudo gem install json_pure
/Library/Ruby/Site/1.8/rubygems.rb:777:in `report_activate_error': Could not find RubyGem json_pure (>= 0) (Gem::LoadError)
I have tried downloading the gem and installing it locally, but rubygems still complains about the dependency.
I had this exact problem, and the above solutions didn't work for me. (I don't use rvm, and re-installing RubyGems didn't resolve the issue.)
This is what I did to fix my setup on my Mac. (Ruby 1.8.6, Mac OS X 10.5.8)
1) Go to http://rubygems.org/gems/json_pure
2) Download the json_pure gem to ~/Downloads
3) cd ~/Downloads/
4) sudo gem install json_pure-1.4.6.gem
(You'll still see the "Could not find RubyGem json_pure" error, but the install does work. To double-check you can redo 'sudo gem install json_pure-1.4.6.gem' and you shouldn't see the error the second time.)
5) Verify that json_pure is now installed:
gem list
I fixed this issue by copying the json and json_pure gems and their specs from a working ruby directory into the .rvm gem directory of the broken ruby. Not sure why rubygems itself ever relies on another gem.
cp -r ~/.rvm/gems/ruby-1.8.7-p249/gems/json* ~/.rvm/gems/ruby-1.8.6-p399/gems/
cp -r ~/.rvm/gems/ruby-1.8.7-p249/specifications/json* ~/.rvm/gems/ruby-1.8.6-p399/specifications/
I can't understand if you are having an issue installing RVM or using RVM.
If you need to install RVM, don't use sudo.
Just type
$ gem install rvm
RubyGems will install it in your home directory.
Then, proceed with rvm-install and follow the instructions.
When using RVM, never use sudo.
This issue came about when I removed all the json-pure versions in my main $PATH. To resolve the issue I reloaded RubyGems 1.3.7 from source and was able to reinstall the json-pure gem. Note: I was not using RVM.
Steps:
1) Download RubyGem 1.3.7.tgz
2) Use these commands at the command prompt
tar xzvf rubygems-1.3.7.tgz
cd rubygems-1.3.7
sudo /opt/local/bin/ruby setup.rb
3) Try a gem command
gem list
4) If it works, install the json-pure gem // might need to install the json gem also.
sudo gem install json
sudo gem install json-pure

Resources