Rails 3 应用程序部署、Bundler &耙子问题
部署 Rails3 应用程序,并且在使用 rake 查找“bundle install --deployment”安装的 gem 时遇到一些问题:
$ rake db:migrate
(in /home/jrdev/rails/testapp)
rake aborted!
!!! Missing the mysql2 gem. Add it to your Gemfile: gem ‘mysql2’
但是,该 gem 是 Gemfile,并且也在供应商/bundle 文件夹中......
$ bundle show mysql2
/home/jrdev/rails/testapp/vendor/bundle/ruby/1.8/gems/mysql2-0.2.6
我的 .gemrc 文件:
gemhome: /home/jrdev/.gems
gempath:
- /home/jrdev/.gems
- /usr/lib/ruby/gems/1.8
我认为 Rails3 应用程序已经有了捆绑器代码来检测要使用哪些 gem?我知道我也使用正确的 rake (rake db:migrate --trace 从 /home/jrdev/rails/testapp/vendor/bundle/ruby/1.8/bin/rake 开始)。使用捆绑器的 exec 得到相同的结果。
:(
Deploying a Rails3 app, and am having some issues getting rake to find the gems installed by 'bundle install --deployment':
$ rake db:migrate
(in /home/jrdev/rails/testapp)
rake aborted!
!!! Missing the mysql2 gem. Add it to your Gemfile: gem ‘mysql2’
But, that gem in is the Gemfile, and is also in the vendor/bundle folder…
$ bundle show mysql2
/home/jrdev/rails/testapp/vendor/bundle/ruby/1.8/gems/mysql2-0.2.6
My .gemrc file:
gemhome: /home/jrdev/.gems
gempath:
- /home/jrdev/.gems
- /usr/lib/ruby/gems/1.8
I thought rails3 apps already had the bundler code to detect which gems to use? I know I'm using the right rake, too (rake db:migrate --trace starts in /home/jrdev/rails/testapp/vendor/bundle/ruby/1.8/bin/rake). Same result using bundler's exec.
:(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
难道你不知道我问完后一分钟就解决了吗?
我的database.yml 文件仍然调用“mysql”适配器而不是“mysql2”。
不过,这是多么晦涩难懂的错误消息啊!
Wouldn't you freaking know I solve it a minute after asking.
My database.yml file was still calling the 'mysql' adapter instead of 'mysql2'.
Still, what an OBSCURE error message!
在
/home/jrdev/rails/testapp
中,您应该找到一个名为Gemfile
的文件。查看它并在某处添加该行。
In
/home/jrdev/rails/testapp
, you should find a file calledGemfile
. Look into it and just add the linesomewhere.