更新时间:2022-10-17 23:23:28
拉我的头发我发现了什么问题,所以我张贴它可能会遇到同样的情况。
bundler之所以不会安装mysql2是因为gem是在这个 platforms 结构中的,见下:
platforms:mri_19, :mingw_19 do
group:mysql do
gemmysql2,0.3.11
end
end
因此,我所做的只是将gemmysql2,0.3.11自身移动到Gemfile的顶部,然后运行 bundle install 而且做到了!现在,mysql2列在bundle show下,我的rails应用程序正在运行。
感谢每一位试图提供帮助的人!
First of all I've gone through dozens of posting here on SO and google and haven't been able to find an answer. I'm trying to install mysql2 with bundler and it won't do it.
Running on Ubuntu Server 11.04 Natty
Here's some background info:
ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [x86_64-linux]
gem -v
1.8.24
rails -v
Rails 3.2.5
$ mysql --version
mysql Ver 14.14 Distrib 5.1.62, for debian-linux-gnu (x86_64) using readline 6.2
I have gem "mysql2", "~> 0.3.11" in my Gemfile
When I do bundle install it goes through the process and it finishes successfully (No Errors) but it doesn't install mysql2. When I do bundle show, mysql2 is not listed.
I've tried a gazillion of things recommended here and on forums and still can't get mysql2 to install with bundler.
Any ideas?
Thanks.
So after many tries, reading, and pulling my hair out I found out what was the problem, so I'm posting it for those that might run into the same situation.
The reason why bundler wouldn't install mysql2 is because the gem was inside this platforms structure, see below:
platforms :mri_19, :mingw_19 do
group :mysql do
gem "mysql2", "0.3.11"
end
end
So all I did was to move just gem "mysql2", "0.3.11" by itself to the top of the Gemfile and run bundle install and that did it! Now mysql2 is listed under bundle show and my rails application is running now.
Thanks every one that tried to help!