2010-11-04 69 views
1

我是一个全新的RoR,没有太多的Web开发经验。我通常在这一点上放弃,但我需要一个RoR开发环境才能找到工作,而且我无法选择网站创建者的大脑,因为他是公司以外的人,并且明确表示他完全不熟悉Windows(他开发在Mac上,我开始明白为什么......)。这是我第一次发布这样善良......Ruby DevKit不适用于WindowsXP上的RedCloth和其他宝石

目标:能够查看本地计算机上的基于RoR的网站,最好使用预先存在的XAMMP服务器,但使用Rails服务器将罚款太。


环境: 的Windows XP XAMMP 1.7.3 红宝石9.1.2 的devkit 4.5.0。

我已经试过: 我开始使用本教程之后的方向(在Windows计算机上安装http://www.grapethinking.com/getting-rails-to-work-on-a-windows-machine-running-xampp XAMPP和Rails)。我成功完成了所有步骤,并能够创建一个Rails应用程序并查看“Welcome Aboard”页面。

我收到了一个关于他们使用的ror托管服务的heroku(http://heroku.com/)的本地副本。我按照Xampp和Rails教程的第5步中所述修改了Apache配置文件以指向站点的公用文件夹。在这一点上我去到localhost时以下消息:3000

Access forbidden! 

You don't have permission to access the requested directory. There is either no index document or the directory is read-protected. 

If you think this is a server error, please contact the webmaster. 
Error 403 
localhost 
11/4/2010 2:19:12 PM 
Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1 

我不知道如何更改Windows机器上的权限,或者这是连问题。我试图运行“轨道的”这抱怨:

Could not find RedCloth-4.2.3 in any of the sources, Try running 'bundle install'. 

所以我发现这个职位它说明了我的情况(http://www.ruby-forum.com/topic/204455),这导致我下载的devkit。此时我卸载了ruby并使用正确的安装程序重新安装了它。我按照其网站上的说明安装了开发工具包(https://github.com/oneclick/rubyinstaller/wiki/Development-Kit)。

DevKit无法正常工作。 config.yml文件自动具有我安装ruby的位置(在.... xampp/ruby​​/Ruby192中),并且它没有抱怨地运行,除了在步骤5中测试它是否实际上使用命令“gem install rdiscount --platform =红宝石”,这将产生以下错误:

C:\RubyDevKit>gem install rdiscount --platform=ruby 
Temporarily enhancing PATH to include DevKit... 
Building native extensions. This could take a while... 
ERROR: Error installing rdiscount: 
     ERROR: Failed to build gem native extension. 

"C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/XAMPP_Install 
/xampp/ruby/Ruby192/bin/ruby.exe" extconf.rb 
checking for random()... *** 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:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010 
/XAMPP_Install/xampp/ruby/Ruby192/bin/ruby 
     --with-rdiscount-dir 
     --without-rdiscount-dir 
     --with-rdiscount-include 
     --without-rdiscount-include=${rdiscount-dir}/include 
     --with-rdiscount-lib 
     --without-rdiscount-lib=${rdiscount-dir}/lib 
C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/XAMPP_Install/ 
xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed t 
o generate an executable file. (RuntimeError) 
You have to install development tools first. 
     from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X 
AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:435:in `try_link0' 
     from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X 
AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:440:in `try_link' 
     from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X 
AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:552:in `try_func' 
     from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X 
AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:797:in `block in have_fun 
c' 
     from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X 
AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking 
_for' 
     from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X 
AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) 
in postpone' 
     from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X 
AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:254:in `open' 
     from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X 
AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone 
' 
     from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X 
AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:254:in `open' 
     from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X 
AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:276:in `postpone' 
     from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X 
AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for' 
     from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X 
AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:796:in `have_func' 
     from extconf.rb:5:in `<main>' 


Gem files will remain installed in C:/Documents and Settings/Lyla/My Documents/n 
ew/XAMPP_Server_2010/XAMPP_Install/xampp/ruby/Ruby192/lib/ruby/gems/1.9.1/gems/r 
discount-1.6.5 for inspection. 
Results logged to C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2 
010/XAMPP_Install/xampp/ruby/Ruby192/lib/ruby/gems/1.9.1/gems/rdiscount-1.6.5/ex 
t/gem_make.out 

所以它确实有‘暂时提升路径包括的devkit ......’但没有别的作品。尝试安装RedCloth时发生类似的错误。

我发现这个职位似乎很相关,但它是为获得DBD-ODBC宝石,不管它是什么,工作和解决方案似乎有些特定于: I can't get the ruby development kit working for Windows XP

我不知道他正在讨论修改fstab文件......也许这会帮助我?不幸的是我找不到fstab文件,我的devkit根文件夹中没有msys文件夹。我无法在ruby install的bin文件夹或devkit中的各个bin文件夹中找到gcc.bat,make.bat或sh.bat。

还有这个帖子(http://www.ruby-forum.com/topic/186191),它暗示了一些我不能真正遵循的东西......它也是从2009年开始的,所以我认为它可能是旧的。

帮助和谢谢!

+0

我收到错误消息“您必须先安装开发工具。”即使它告诉了我一切,“临时增强PATH以包括DevKit ...”。事实证明,我有错误的devkit版本,我需要ruby 1.9的“tdm”devkit,而不是仅用于ruby 2.0的最新开发包。 – Ninjaxor 2013-07-04 17:19:43

回答

0

说实话,我实际上并不打算在Windows上设置它。它可能是完全无法管理的,并且有时会令人沮丧(我从经验中知道这一点)。有一个原因是有一个使用Windows的Rails开发人员的小社区。大多数人都使用OS X或Linux。

创建一个类似VirtualBox(免费)的Ubuntu虚拟机,并在那里设置Rails堆栈。这是一个更加无痛的环境,你不会回头看。或者,如果您不想自己完成所有设置,请使用BitNami RubyStack。这是一个预配置的Ruby/Rails环境,您可以将其用作虚拟机,或者安装在您的计算机上(我会选择前者)。

希望有帮助!

+0

谢谢!我最终需要开发人员来帮助我(他没有提供关于他的网站的gems/libraries的文档),但是当他看到安装有Ubuntu的VirtualBox VM时,他帮助很大。 Bitnami的rubystack对我来说有一个网络问题,但是我发现了一个名为VirtualRails的简洁包装(http://www.virtualrails.org/,确保你从法语更换键盘并拥有所需的7+ GB空间来运行)。它给我带来了90%的方式,但是对于我的情况,有一些问题与一个宝石,所以我们最终做了一个干净的Ubuntu安装。希望这可以帮助别人! – Lyla 2010-11-15 14:41:37

+0

太棒了 - 很高兴你在运行!我更喜欢Ubuntu/VirtualBox组合来使用Windows来开发Rails应用程序。如果您发现它有帮助,请不要忘记标记为答案! :) – codykrieger 2010-11-17 03:29:13

0

这里就是我做的人谁可能会感兴趣:

平台:Windows 7的 轨道4 红宝石1.9.2p0

  1. 安装了Ruby,通过rubyinstaller.org
  2. 下载的devkit
  3. 从Ruby增强的CMD提示符下,“ruby dk.rb init”,紧跟着“ruby dk.rb install”
  4. 下载了SQLLit从这里èDLL文件:sqlite.org,复制它们到C:\ Windows目录
  5. 从红宝石增强CMD提示, “创业板安装RedCloth”
  6. 增加了 “宝石RedCloth” 来的Gemfile
  7. “包安装”

这些步骤对我有用!我不明白为什么人们在Windows上使用Ruby很难。这就是我所开发的,并且工作正常。