ruby-on-rails - 使用 pik 接收 : "ERROR: Failed to build gem native extension" when trying to install rails gem on ruby 1. 9.2

标签 ruby-on-rails ruby windows pik

我试图将我的本地数据库推送到 Heroku 并收到此错误:

...点击服务器错误:PGError: ERROR: time zone displacement out of range:...

后来谷歌搜索我发现这个错误不会发生在 ruby 1.9.2 并且(因为在 Windows 上)我必须安装 pik 到与 1.9.3 一起运行 1.9.2。所以我安装了 pik 和 ruby​​ 1.9.2。

但是,当我尝试在 1.9.2 上安装 rails 时,出现此错误:

...错误:无法构建 gem native 扩展...

经过大量谷歌搜索后,我遇到了以下问题:

  • 不要费心使用 Windows 进行 ruby​​/rails 开发 :(
  • 与 devkit 有关吗?
  • 或者安装 rails 的二进制套件版本?
  • 自己编译

非常感谢任何帮助!

编辑:

完整的错误堆栈跟踪:

Building native extensions.  This could take a while...
ERROR:  Error installing rails:
        ERROR: Failed to build gem native extension.

C:/Ruby192/bin/ruby.exe extconf.rb
creating Makefile

make
gcc -I. -IC:/Ruby192/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby192/include/ruby-1.9.1/ruby/backward -
I/C/Ruby192/include/ruby-1.9.1 -I. -DJSON_GENERATOR    -O3 -g -Wextra -Wno-unused-parameter -Wno-par
entheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -O3 -Wall -O
0 -ggdb  -o generator.o -c generator.c
make: gcc: Command not found
make: *** [generator.o] Error 127


Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/json-1.7.6 for inspection.
Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/json-1.7.6/ext/json/ext/generator/gem_make.out

最佳答案

错误消息的相关部分是gcc: Command not found;因此编译器无法在本地编译代码。

如果您的机器上已经安装了 gcc,请确保它包含在 PATH 中。

检查 How to install gcc on windows 7 machine?有关如何在 Windows 上安装 gcc 的指导。

关于ruby-on-rails - 使用 pik 接收 : "ERROR: Failed to build gem native extension" when trying to install rails gem on ruby 1. 9.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14656098/

相关文章:

ruby-on-rails - rails 4 : Flash message persists for the next page view

php - PHP 中的奇怪错误、路径中的空格和 Windows

PHP 热敏打印客户端

windows - 免费注册 (Regfree) COM

ruby-on-rails - ActiveRecord 更改或重置范围中定义的排序

ruby-on-rails - 如何用绝对路径 URL 替换相对路径 URL

ruby - 在模块中使用 extend self

ruby - 安装 Xcode 4.2 后无法使用 native 扩展构建 json (1.6.3)

ruby-on-rails - 如何清空/销毁 Rails 中的 session ?

ruby-on-rails - 未定义的方法 `async'(吸盘 gem )