(can't activate mysql2 (~> 0.3.10), already activated mysql2-0.5.4. Make sure all dependencies are added to Gemfile.) - ruby-on-rails-3

Ubuntu 20.04
Rails 3.2.22.5
Ruby 2.3.7
mysql2 8.0.29
Above are the versions that currently i'm using for my project(app).
In Gemfile mysql2 version is 0.3.18 but this version throwing me errors and not allowing me to run complete bundle.
But, when i'm trying to run bundle with different version of mysql2 gem like 0.5.4, bundle successfully running but after that when i try to create db(database) or to start server this above error mentioned in question appears.
Anyone please help me out in this regard if you guys have any idea about that.
Thanks in advance

Related

Multiple PSQL gems causing problems

I have a rails 3.2.8 site that was configured to use Postgres.App. The gem it was using was pg (0.12.2) It was working fine. I wanted to build another app and so set everything up as with the other app but I was getting this error:
/.rvm/gems/ruby-1.9.3-p194/gems/pg-0.17.1/lib/pg.rb:4:in `require': dlopen(/Users/********/.rvm/gems/ruby-1.9.3-p194/gems/pg-0.17.1/lib/pg_ext.bundle, 9): Library not loaded: #executable_path/../lib/libssl.1.0.0.dylib (LoadError) Referenced from: /Applications/Postgres.app/Contents/MacOS/lib/libpq.dylib Reason: image not found - /Users/***********/.rvm/gems/ruby-1.9.3-p194/gems/pg-0.17.1/lib/pg_ext.bundle
The gem in use here was pg (0.17.1) and I thought the discrepancy might be causing the problem so I uninstalled and reinstalled the gems. Now neither of them work and I get the same error message for both apps.
The Postgres.App version is 9.2.4.1
The solution that worked was to upgrade Postgres.App to the latest version, which I did by simply downloading the newest version and saving it over the top of the old one. Apparently there were some bugs in the earlier version. It now works fine for me.

Passenger throws Bundler::GemfileError after "gem update --system"

Background
On my local machine, I tried installing the 'bullet' gem via my gemfile, and bundle seemed to go without incident, however upon restarting my app passenger began throwing the error Invalid gemspec for uniform_notifier. It seems someone else had this issue and the suggested resolution on StackOverflow said to update RubyGems by running:
The issue
gem update --system
This produced no error messages upon running, however now none of apps will start. They all give the same vague Passenger error:
PhusionPassenger::UnknownError
There was an error in your Gemfile, and Bundler cannot continue. (Bundler::GemfileError)
I removed 'bullet' from my gemfile so it's now back in a state when it was working yesterday, so I don't think there can be an error in my gemfile. Furthermore, all of my other apps are now broken and their gemfiles haven't changed at all.
For reference:
ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.5.0]
rails -v
Rails 3.2.6
rvm --version
rvm 1.1.4 by Wayne E. Seguin
And when I do gem list for the global and local gemsets, it shows bundler 1.1.0 installed.
Edit: I should also mention that running rails s starts up a WEBrick server just fine and I can access my apps at localhost:3000, so it's only under Passenger that this error crops up.
Have you committed your Gemfile.lock?
I was able to fix this by rolling back rubygems-update to the previously installed version by running
gem update --system 1.8.11
At which point all of my apps began working again. I'm still not sure what the problem was, and will gladly switch the accepted answer from my own to someone who can provide more insight into why updating rubygems-update would break Passenger integration.
I wish someone from Phusion Passenger would give a definitive answer but just wanted to say that I've experienced the same thing. Updating rubygems has broken passenger-nginx integration for us and requires recompiling the passenger-nginx module. Not sure why this would be. My speculation is that the module is somehow compiled with a hard reference to a specific version of rubygems.

Difficulty with activesupport when attempting to deploy

I have a rails application that I am trying to deploy onto the internet. I have setup a server on the Amazon EC2 cloud, that I know works because I have deployed another site to the same machine.
When I try to run this new application either through 'rails console' or when running 'rake db:seed' or just by trying to browse to the application, rails crashes saying it cannot find activiesupport:
/home/ec2-user/.gem/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/core_ext/big_decimal/conversions.rb:1:in `require': cannot load such file -- bigdecimal (LoadError)
My Rails version is 3.2.2 and I'm using ruby 1.9.3p0 (2011-10-30) [x86_64-linux]. My database is MongoDB which I access through Mongoid. And I'm using Passenger and Apache as a server.
Is there any configuration step or something like that that I have missed?
P.S. I know I shouldn't be using ec2-user, I'm still experimenting. And also, I've never had much luck with RVM.
I encountered the same problem with Rails 3.2.3 and Ruby 1.9.3p0 on my Amazon EC2 instance, where Ruby had been installed with the ruby19 yum package. In my case, the problem seemed to be that I had installed the bigdecimal gem manually using the gem command instead of using Bundler. To fix the problem, I uninstalled the gem manually, added the line
gem 'bigdecimal'
to my application's Gemfile, and re-ran bundle install. This reinstalled the gem and then my application was able to load it successfully.
My gems are also installed in ~/.gem/ruby/1.9.1/, even though I am running Ruby 1.9.3p0. This does not appear to be a problem.

Installed RVM and now my rails server won't start

I had started the Rails app yesterday and got everything working.
Then today I decided to go with RVM, as I realized I might have need of it. So I uninstalled all gems, installed RVM and have now a working(?) RVM.
I reinstalled the gems and now my bundle exec rails server crashes
$ bundle exec rails server
[BUG] cross-thread violation on rb_gc()
(null)
Abort trap: 6
Crashreport
I have no idea whats wrong with my installation, as there is no reasonable error' which I could understand. :(
Edit: Gemfile
Try adding gcc-4.2 as your default C compiler to your bash profile:
export CC=/usr/bin/gcc-4.2
Then reinstall your rubies. You need XCode 4.1 to be installed before 4.2, otherwise you won't have gcc-4.2. The easiest way is to uninstall 4.2, and then install 4.1, then upgrade to 4.2.
Check out this solution: Error: cross-thread violation on rb_gc()
It looks like this might be an issue with a ruby version difference between your system and RVM. There are a few other articles out there on how to clean this up, like the one below, but I'm not sure which one will work for you:
http://blog.ubrio.us/nix/osx-rubygems-and-cross-thread-violations-in-rb_gc/
Great, the answer was to use ruby 1.9.3 instead of 1.9.2 ...

Problem with installing rails-3 plugins (Win7)

I'm newbie at ruby, I spent couple hours trying to find the way to install the plugin... but without any success, so here I am, very frustrated... please help.
OS: W7
ruby: ruby 1.9.2
rails: 3.0.5
msysgit: 1.7.4 (i did not any changes, just installation)
(is there anything else I should of mentioned?)
ruby script/plugin install git://github.com/thoughtbot/paperclip.git/
C:\Ruby\Ruby192\bin\ruby.exe: Permission denied -- script/plugin (LoadError)
Thank you!
The script/plugin command (and all other script/<exec> commands) is no longer used in Rails 3, instead you should do:
rails plugin install git://github.com/thoughtbot/paperclip.git