天天看點

在win7搭建ROR開發環境

之前一直在Ubuntu下開發ROR,在win7下開發Android。最近需要在同一個系統下同時進行開發,Ubuntu的空間有限,于是就放棄了在Ubuntu下安裝Android的政策,改為在win7下安裝ROR,為了以後節省時間,将一些問題記錄如下。

1、直接用railsinstaller進行一鍵安裝,這一步基本沒什麼問題

2、安裝pik,相當于Ubuntu下的rvm

3、安裝mysql, sphinx(選擇适當的版本,根據Thinking sphinx的版本來定  http://pat.github.io/thinking-sphinx/installing_sphinx/windows.html)

4、将github上的項目clone到本機(之前在Ubuntu下開發的應用)

5、直接bundle install,這時會出現一些問題:

a) rmagick問題,一定要注意imagemagick的版本(6.8以上的都不行,否則會出現問題,在這裡折騰了半天才發現)https://github.com/rmagick/rmagick/wiki

b) mysql-connect-c的問題,将mysql-connector-c 中的libmysql.dll複制到railsinstaller/ruby1.9.3/bin下,注意版本問題(錯誤提示會有版本資訊),然後重新安裝mysql2     gem

c) mysql : cannot connect to mysql server on 'localhost'  将database.yml 中的host: localhost 改為 host: 127.0.0.1 

6、rake db:create rake db:migrate 

7、啟動 rails s ,出現問題:

ActionView::Template::Error (different prefix: "c:/" and  ...) 解決方法:      
http://stackoverflow.com/questions/10198141/import-bootstrap-error-on-win7-showing-500-error