[英]Rails Setup: mysql2 gem always causing problems
I'm fairly new when it comes to commandline or Rails, but work on a rails project where I'm doing the frontend. 在命令行或Rails方面,我还是一个新手,但是在我做前端的Rails项目中工作。
I've installed all gems that are needed for the project, but lately some errors occur when doing a rake:db migrate
or today when trying to deploy the current version via cap production deploy
我已经安装了该项目所需的所有gems,但是最近在进行
rake:db migrate
或今天尝试通过cap production deploy
来部署当前版本时发生了一些错误。
The problem I'm facing seems to have todo with the mysql2
gem. 我面临的问题似乎与
mysql2
gem有关。 At least that is what the console says. 至少控制台就是这样说的。
When running cap production deploy
I get this error: 运行
cap production deploy
以下错误:
rake stdout: Nothing written
rake stderr: rake aborted!
Gem::LoadError: Specified 'mysql2' for database adapter, but the gem is not loaded. Add `gem 'mysql2'` to your Gemfile.
and further down this … 并进一步下去...
Gem::LoadError: can't activate mysql2 (~> 0.3.10), already activated mysql2-0.4.2. Make sure all dependencies are added to Gemfile.
What do I have todo here? 在这里我该怎么办? When I do
gem list
I see that mysql2 is installed. 当我执行
gem list
我看到已安装mysql2 。
Thank you, Matt 谢谢你,马特
Rails used to have the mysql2
gem locked down to ~>0.3
in the codebase. Rails过去将
mysql2
gem在代码库中锁定为~>0.3
。
So that is what it looks for but your Gemfile will simply state 这就是它的外观,但是您的Gemfile只会声明
gem "mysql2"
Pretty sure they've updated this in the latest release of rails 4 so either: 可以肯定的是,他们已经在最新版本的rails 4中对此进行了更新,因此:
Update to the latest version of rails 4 or use a specific version of the mysql2 gem 更新到最新版本的Rails 4或使用特定版本的mysql2 gem
gem "mysql2", "~> 0.3.20"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.