rake db:migrate 失败:寻找 RMagick - 为什么?

发布于 2024-09-24 23:19:07 字数 2770 浏览 1 评论 0原文

我刚刚创建了一个到现有项目的简单迁移。该项目使用 RMagick,当我调用 rake db:migrate 时,迁移失败:

Dans-iMac-335:myserver apple$ rake db:migrate
(in /Users/apple/Documents/projects/electionjoy/glowing-mist-78)
dlopen(/Users/apple/.gem/ruby/1.8/gems/rmagick-2.12.1/lib/RMagick2.bundle, 9): Library not loaded: /usr/local/libpng/lib/libpng12.0.dylib
  Referenced from: /Users/apple/.gem/ruby/1.8/gems/rmagick-2.12.1/lib/RMagick2.bundle
  Reason: image not found - /Users/apple/.gem/ruby/1.8/gems/rmagick-2.12.1/lib/RMagick2.bundle
/Users/apple/.gem/ruby/1.8/gems/rmagick-2.12.1/lib/RMagick2.bundle
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
/Users/apple/.gem/ruby/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
/Users/apple/.gem/ruby/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
/Users/apple/.gem/ruby/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
/Users/apple/.gem/ruby/1.8/gems/rmagick-2.12.1/lib/RMagick.rb:11

还有更多,但这是它寻找 RMagick 的地方。该捆绑包存在于该位置。

为什么数据库迁移需要 RMagick gem 存在?这个问题的解决办法是什么?我在 OS X 10.6 上使用 Rails 2.2.2,这是本地 gem 列表:

* LOCAL GEMS *

actionmailer (2.3.8, 2.3.5, 2.2.2)
actionpack (2.3.8, 2.3.5, 2.2.2)
actionwebservice (1.2.3)
activemerchant (1.5.1)
activerecord (2.3.8, 2.3.5, 2.2.2)
activerecord-tableless (0.1.0)
activeresource (2.3.8, 2.3.5, 2.3.3, 2.2.2)
activesupport (2.3.8, 2.3.5, 2.3.3, 2.2.2)
authlogic (2.1.5)
authlogic-oid (1.0.4)
aws-s3 (0.6.2)
builder (2.1.2)
capistrano (2.5.9)
cgi_multipart_eof_fix (2.5.0)
chronic (0.2.3)
configuration (1.1.0)
daemons (1.0.10)
facebooker (1.0.62)
faker (0.3.1)
fastthread (1.0.7)
gem_plugin (0.2.3)
google-geocode (1.2.1)
heroku (1.8.5, 1.3.0, 1.0.1)
highline (1.5.1)
hoe (2.3.3)
hpricot (0.8.1)
json (1.1.9)
json_pure (1.2.4, 1.1.9)
launchy (0.3.3)
less (1.2.20)
libxml-ruby (1.1.3)
mime-types (1.16)
minitest (1.4.2)
mongrel (1.1.5)
mutter (0.5.3)
mysql (2.8.1)
net-scp (1.0.2)
net-sftp (2.0.2)
net-ssh (2.0.15)
net-ssh-gateway (1.0.1)
nokogiri (1.3.3)
packet (0.1.15)
paperclip (2.3.1.1)
passenger (2.2.5)
pg (0.9.0, 0.8.0)
polyglot (0.3.1)
postgres (0.7.9.2008.01.28)
rack (1.1.0, 1.0.1, 1.0.0)
radiant (0.8.1)
rails (2.3.8, 2.3.5, 2.2.2)
rake (0.8.7)
rc-rest (3.0.0)
RedCloth (4.2.3)
rest-client (1.3.1, 1.0.3)
rmagick (2.13.1, 2.12.1)
ruby-openid (2.1.7)
rubyforge (2.0.4, 2.0.2)
rubygems-update (1.3.7, 1.3.5)
searchlogic (2.3.5)
sequel (3.0.0)
sinatra (0.9.2)
spree (0.10.2)
sqlite3-ruby (1.2.5, 1.0.1)
state_machine (0.8.0)
stringex (1.0.3)
taps (0.2.26, 0.2.19)
thor (0.9.9)
treetop (1.4.8)
whenever (0.3.7)
will_paginate (2.3.11)
xml-simple (1.0.12)

I just created a simple migration to an existing project. This project uses RMagick, and when I call rake db:migrate the migration fails thus:

Dans-iMac-335:myserver apple$ rake db:migrate
(in /Users/apple/Documents/projects/electionjoy/glowing-mist-78)
dlopen(/Users/apple/.gem/ruby/1.8/gems/rmagick-2.12.1/lib/RMagick2.bundle, 9): Library not loaded: /usr/local/libpng/lib/libpng12.0.dylib
  Referenced from: /Users/apple/.gem/ruby/1.8/gems/rmagick-2.12.1/lib/RMagick2.bundle
  Reason: image not found - /Users/apple/.gem/ruby/1.8/gems/rmagick-2.12.1/lib/RMagick2.bundle
/Users/apple/.gem/ruby/1.8/gems/rmagick-2.12.1/lib/RMagick2.bundle
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
/Users/apple/.gem/ruby/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
/Users/apple/.gem/ruby/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
/Users/apple/.gem/ruby/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
/Users/apple/.gem/ruby/1.8/gems/rmagick-2.12.1/lib/RMagick.rb:11

There's more, but this is where it looks for RMagick. The bundle exists at that location.

Why would a database migration require the RMagick gem be present? And what is the fix for this problem? I'm using Rails 2.2.2 on OS X 10.6, here's the local gem list :

* LOCAL GEMS *

actionmailer (2.3.8, 2.3.5, 2.2.2)
actionpack (2.3.8, 2.3.5, 2.2.2)
actionwebservice (1.2.3)
activemerchant (1.5.1)
activerecord (2.3.8, 2.3.5, 2.2.2)
activerecord-tableless (0.1.0)
activeresource (2.3.8, 2.3.5, 2.3.3, 2.2.2)
activesupport (2.3.8, 2.3.5, 2.3.3, 2.2.2)
authlogic (2.1.5)
authlogic-oid (1.0.4)
aws-s3 (0.6.2)
builder (2.1.2)
capistrano (2.5.9)
cgi_multipart_eof_fix (2.5.0)
chronic (0.2.3)
configuration (1.1.0)
daemons (1.0.10)
facebooker (1.0.62)
faker (0.3.1)
fastthread (1.0.7)
gem_plugin (0.2.3)
google-geocode (1.2.1)
heroku (1.8.5, 1.3.0, 1.0.1)
highline (1.5.1)
hoe (2.3.3)
hpricot (0.8.1)
json (1.1.9)
json_pure (1.2.4, 1.1.9)
launchy (0.3.3)
less (1.2.20)
libxml-ruby (1.1.3)
mime-types (1.16)
minitest (1.4.2)
mongrel (1.1.5)
mutter (0.5.3)
mysql (2.8.1)
net-scp (1.0.2)
net-sftp (2.0.2)
net-ssh (2.0.15)
net-ssh-gateway (1.0.1)
nokogiri (1.3.3)
packet (0.1.15)
paperclip (2.3.1.1)
passenger (2.2.5)
pg (0.9.0, 0.8.0)
polyglot (0.3.1)
postgres (0.7.9.2008.01.28)
rack (1.1.0, 1.0.1, 1.0.0)
radiant (0.8.1)
rails (2.3.8, 2.3.5, 2.2.2)
rake (0.8.7)
rc-rest (3.0.0)
RedCloth (4.2.3)
rest-client (1.3.1, 1.0.3)
rmagick (2.13.1, 2.12.1)
ruby-openid (2.1.7)
rubyforge (2.0.4, 2.0.2)
rubygems-update (1.3.7, 1.3.5)
searchlogic (2.3.5)
sequel (3.0.0)
sinatra (0.9.2)
spree (0.10.2)
sqlite3-ruby (1.2.5, 1.0.1)
state_machine (0.8.0)
stringex (1.0.3)
taps (0.2.26, 0.2.19)
thor (0.9.9)
treetop (1.4.8)
whenever (0.3.7)
will_paginate (2.3.11)
xml-simple (1.0.12)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

风情万种。 2024-10-01 23:19:07

我不知道为什么你的机器没有找到它,但是 Rails 中的 rake 任务需要你的应用程序配置使用的任何 gem,即使代码没有被调用。

如果没有,其他一些调用(被丢失的 gem 覆盖)可能会发生并导致意外的行为。

I don't know why your machine is not finding it, but rake tasks in rails require any gem that your app is configured to use, even if the code is not called.

If it didn't, some other call (that is overridden by a missing gem) might happen and result in unexpected behavior.

浮华 2024-10-01 23:19:07

执行 Rake 任务(例如执行数据库迁移)时会加载整个 Rails 环境,其中包括 gem 依赖项。最近,当我恢复一个旧项目时,我也遇到了同样的问题,并且在安装了某些不相关的 gem 之前我无法迁移数据库。

通过查看堆栈跟踪中的信息(未加载库:/usr/local/libpng/lib/libpng12.0.dylib),我怀疑 ImageMagick 未在您的计算机上正确安装。您可能想要提供此脚本 尝试一下。

The entire Rails environment is loaded when executing a Rake task such as performing a database migration and that includes gem dependencies. I got bitten by the same thing recently when resurrecting an old project and I couldn't migrate the database until I'd installed certain unrelated gems.

From looking at the information in the stack trace (Library not loaded: /usr/local/libpng/lib/libpng12.0.dylib) I would suspect that ImageMagick is not installed correctly on your machine. You might want to give this script a try.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文