Error installing pg, requires Ruby version >= 2.2 - ruby-on-rails

gem install pg
ERROR: Error installing pg:
pg requires Ruby version >= 2.2.
This happened after I installed a newer version of PG on my system, so I figure that's fine, what's happening is that it's installing gem pg using the config from the newer version of Postgres that I installed with Homebrew.
So I figure I'll just install the gem using the older version of PG that I had before.
brew install postgresql#9.6
Error: postgresql#9.6 9.6.14 is already installed
Ok perfect! So I then located the pg_config file and am trying to install the gem pg using that config:
gem install pg -- --with-pg-config=/usr/local/Cellar/postgresql#9.6/9.6.14/bin/pg_config
ERROR: Error installing pg:
pg requires Ruby version >= 2.2.
Yet the error persists... any help appreciated... I've tried uninstalling/reinstalling PG a number of times now...
Also something else that's super frustrating... is there a list somewhere that shows what versions of PG are compatible with which versions of Ruby? I feel like every few months I run into this problem and have this frustrating search happening...
ruby --version
> ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
which ruby
> /Users/jamesdong/.rvm/rubies/ruby-2.1.2/bin/ruby
which gem
> /Users/jamesdong/.rvm/rubies/ruby-2.1.2/bin/gem

According to the Changelog, pg 1.2.0 removed support for Ruby <= 2.2. Since you're using 2.1 you'll want to gem install pg -v 1.1.4, the previous version
(I don't think the actual postgres version you're using should matter as much, 1.1.4 appears to support at least up to 11.x)

Related

Trying to run rails server but it is looking for a deprecated gem

In command prompt I run
rails server
and it gives me the error: "could not find nokogiri -1.10.0 in any of the sources"
I then go to install the gem:
gem install nokogiri -v 1.10.0
and git gives me the error: "The last version of nokogiri (=1.10.0) to support your Ruby & RubyGems was 1.10.0. nokogiri requires Ruby version >= 2.3, < 2.7.dev. The current version is 2.7.2.137
How do I get around this issue?
Also, I'm sure I'm going to run into a similar problem again every time I try to run
rails server
It keeps telling me there is a missing gem which tells me me there is something wrong with the install. I have uninstalled and reinstalled Ruby multiple times but the issue doesn't get resolved. Help with my first question would be great but help with my overarching issue would be even more appreciated.
Thanks,
The version of Nokogiri you try to install is not compatible with the latest version of Ruby. You have two options:
Downgrade Ruby to <= 2.6.6 or
Upgrade Nokogiri to >= 1.10.4
It depends on your application which option to choose.
I would prefer upgrading Nokogiri to the latest version. To do so change the version of Nokogiri in your Gemfile to 1.10.10 and run
$ gem install nokogiri -v 1.10.10
$ bundle update nokogiri

How to install mysql2 with new Ruby Version?

I have built an application a few month ago. I downloaded it from Github and I tried to launch it with rails s but I got this error :
'require': cannot load such file -- mysql2/2.6/mysql2
I tried to install it with gem install mysql2
But I get this error :
The last version of mysql2 (>= 0) to support your Ruby & RubyGems was
0.5.2. Try installing it with gem install mysql2 -v 0.5.2
mysql2 requires Ruby version >= 2.0, < 2.6. The current ruby version is 2.6.4.104.
When i tried to do the command suggested with -v 0.5.2 I got the same error.
Does anyone have a solution?
I am on Windows and I don't have rbenv installed.
My Ruby version : ruby 2.6.4p104 (2019-08-28 revision 67798) [x64-mingw32]
Download the gem file manually and installing works
gem i mysql2-0.5.2.gem
Temporarily enhancing PATH for MSYS/MINGW...
Installing required msys2 packages: mingw-w64-x86_64-libmariadbclient
Building native extensions. This could take a while...
Successfully installed mysql2-0.5.2
Parsing documentation for mysql2-0.5.2
Installing ri documentation for mysql2-0.5.2
Done installing documentation for mysql2 after 1 seconds
1 gem installed
Source: https://github.com/brianmario/mysql2/issues/1021

How to install the Nokogiri gem using Ruby 1.9.3

I'm using Ruby 1.9.3 with my Rails v3.2.19 application and I'm unable to run bundle because Nokogiri requires a Ruby version >= 2.1.0. At the moment I cannot upgrade my Ruby version and I really need to install Nokogiri otherwise my app won't run.
Besides the regular solutions using gem install, I've already tried the following command line with no success:
gem install nokogiri -- --use-system-libraries=true --with-xml2-include=/usr/include/libxml2
ERROR:
>Error installing nokogiri:
nokogiri requires Ruby version >= 2.1.0.
Is there a way that I can install Nokogiri using my current Ruby version?
Additional Info:
Rails version - 3.2.19
Ruby version - 1.9.3
Nokogiri version - 1.7.0.1
OS - CentOS 7
The last version of nokogiri to support Ruby 1.9.3 was 1.6.8.1, so you need to do something like
gem install nokogiri -v 1.6.8.1
First try update xcode command line tools xcode-select --install
Then try these steps https://github.com/sparklemotion/nokogiri/wiki/What-to-do-if-libxml2-is-being-a-jerk

Error upgrading rails from 5.0.0.rc1 to 5.0.0.rc2

OS: Mac OS X El-Captain
current rails version: 5.0.0.rc1
ruby version: 2.3.1p112
I'm having following error. Googling and searching on Stack Overflow didn't give any results.
gem install rails -v 5.0.0.rc2
ERROR: While executing gem ... (Gem::Resolver::Molinillo::CircularDependencyError)
There is a circular dependency between camping and rack
I had to uninstall my version of Ruby (2.3.1) and re-install. Then running gem install rails --pre worked.
I use rbenv and ruby-build. The instructions for removing Ruby are found here, https://github.com/rbenv/rbenv#uninstalling-ruby-versions.
This appears to be related to out of date system gems. I encountered it installing bundler. I cleared it by entering :
gem update --system
I can install latest ruby, bundler, rails, and all works fine.
I'm running OS X 10.11.6.
Best,
John

An error occurred while installing autoprefixer-rails (6.2.2). Additionally it say's "autoprefixer-rails requires ruby version >= 2.0. "

Im facing this problem when i'm installing bunder using command "bunlde install"
Initially i tried solving this issue by using following command
gem install autoprefixer-rails -v '6.2.2'
but again it said "autoprefixer-rails requires ruby version >= 2.0."
when i type
"ruby -v", my ruby version shows 2.3.0.
Next i have tried adding
ruby '2.3.0' to my gem file, then there was a conflict saying your ruby version is 1.9.3 but your gem file has 2.3.0
Need help how to proceed further.
Change your ruby version in the system first. If you using rvm then use following command.
rvm use 2.3.0
If you don't have it then install it by following command
rvm install 2.3.0
Delete the Gemfile.lock file and run
bundle install
Hopefully it will work. Thank you

Resources