一、rails2.3.5环境安装:

启动服务器后报如下错误:

Could not find a valid gem 'RMagick' (>= 0) in any repository

下载页,将网页往下卷到rmagick-win32这个分类,直接下载已经编译好的RMagick套件与安装档:
092815311.png

解压缩后先安装ImageMagick程式(如果之前安装过其他版本的ImageMagick则必须先移除) 请注意:不要依据README.html的说明进行安装,否则当你更新了系统套件后可能会让Redmine无法执行。
092901454.png

安装过程中有一步为Select Additional Tasks如下选中

093058247.jpg

开启命令窗口,进入解压缩目录,执行gem  install rmagick --local安装RMagick套件

093413603.png


参考自:http://blog.miniasp.com/post/2011/12/27/Install-Redmine-on-Windows-Notes.aspx



二、rails3.2.3环境安装:

1.下载 ImageMagick

2.下载DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe,

下载地址: http://rubyinstaller.org/downloads/
3.安装DevKit库:

双击执行DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe,选择路径:如(D:\DevKit-tdm-32),然后Extract。

在路径D:\DevKit-tdm-32 下分别执行:ruby dk.rb init;ruby dk.rb install,安装DevKit完成。
如果执行ruby dk.rb init,结果如下:
Initialization complete! Please review and modify the auto-generated'config.yml' file to ensure it contains the root directories to allof the installed Rubies you want enhanced by the DevKit.
没有找到ruby的路径,找到的如图:

160537836.jpg


没有找到就得到DevKit目录下的config.yml 文件下手动添加:



如:
# Example:
#
# ---
# - C:/ruby19trunk
# - C:/ruby192dev
#
---
- C:/Ruby187
其中需要添加的就是红色部分。如果能找到,则文件中就存在该路径。
如果执行ruby dk.rb install出现如下结果:
D:\Ruby187\DevKit>ruby dk.rb install
[INFO] Skipping existing gem override for 'D:/Ruby187'
[WARN] Skipping existing DevKit helper library for 'D:/Ruby187'
那么需要到ruby目录下的\lib\ruby\site_ruby目录,如(D:\Ruby187\lib\ruby\site_ruby)将devkit.rb文件及其备份都删除,然后重新执行ruby dk.rb install命令。
出现如下结果则成功:

160520961.jpg


4.安装ImageMagick,要勾选system path 和c++:

160402104.png

设置其 includelib路径:

160441522.jpg
5.安装rMagick:
打开命令窗口(CMD),执行:bundle install,
安装完成之后,gem list,查看rmagick是否安装成功

如果没有安装,会出现类似一下错误:

D:\DevKit-tdm-32>gem install rmagick

Temporarily enhancing PATH to include DevKit...

Building native extensions.  This could take a while...

ERROR:   Error installing rmagick:
ERROR: Failed to build gem native extension.

C:/Ruby187/bin/ruby.exe extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for stdint.h... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... no

Can't install RMagick 2.13.2. Can't find MagickWand.h.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.   Check the mkmf.log file for more
details.   You may need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby187/bin/ruby


Gem files will remain installed in C:/Ruby187/lib/ruby/gems/1.8/gems/rmagick-2.1
3.2 for inspection.
Results logged to C:/Ruby187/lib/ruby/gems/1.8/gems/rmagick-2.13.2/ext/RMagick/g
em_make.out

如果以上的红色部分的错误如下:
checking for Ruby version >= 1.8.5... yes
checking for stdint.h... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... no
则只需要重新设置第四步中的 include lib路径即可。

如果错误为:
checking for Ruby version >= 1.8.5... yes
checking for stdint.h... no
checking for sys/types.h... no
checking for wand/MagickWand.h... no
则需要重新安装DevKit,安装步骤在一下地址:

https://github.com/oneclick/rubyinstaller/wiki/Development-Kit



转载自:http://blog.sina.com.cn/s/blog_7444213001018fa7.html