我正在尝试在 Windows 机器上安装 ruby,但遇到了问题。当我开始出现错误时,我已经走到了这一步,而且我对 PHP 以外的任何东西都是全新的,用于 Web 开发。帮助表示赞赏!
编辑 我正在按照此处的说明进行操作:
http://www.alexbernard.fr/fichiers/blog/Installer-Ruby-On-Rails-sur-un-Wamp-Server.pdf
./gem install rails --include-dependencies
输出:
INFO: `gem install -y` is now default and will be removed
INFO: use --ignore-dependencies to install only the gems you list
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
C:/wamp/ruby/bin/ruby.exe extconf.rb
creating Makefile
make
generating generator-x64-mingw32.def
compiling generator.c
make: x86_64-w64-mingw32-gcc: Command not found
make: *** [generator.o] Error 127
Gem files will remain installed in C:/wamp/ruby/lib/ruby/gems/2.0.0/gems/json-1.8.0 for inspection.
Results logged to C:/wamp/ruby/lib/ruby/gems/2.0.0/gems/json-1.8.0/ext/json/ext/generator/gem_make.out
最佳答案
根据上面显示的输出,我假设如下:
- 已安装 Ruby 2.0.0 x64(64 位)
- 从 RubyInstaller 页面安装了一些 DevKit
现在,如解释的那样here ,对于 64 位 Ruby,您需要 64 位 DevKit。
从输出中的错误:
make:x86_64-w64-mingw32-gcc:找不到命令
很明显您没有安装正确的 DevKit。
请删除已安装的 DevKit,下载正确的 DevKit(如上面的链接和 RubyInstaller downloads page 中所示)并重新安装。
您将需要使用 ruby dk.rb install --force
(注意 --force
选项)来覆盖之前的 DevKit 安装。
至于弃用错误,不再需要--include-dependencies
。我建议您使用现代 Ruby/Rails 指南作为安装引用。
关于ruby-on-rails - Windows 上的 Rails - 安装问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16579019/