接收:“错误:在使用pik在ruby 1.9.2上安装rails gem时,未能构建gem本地扩展”

时间:2021-05-04 08:59:36

I was trying to push my local database to Heroku and received this error:

我试图将我的本地数据库推到Heroku,却收到了这个错误:

...Taps Server Error: PGError: ERROR: time zone displacement out of range:...

…点击服务器错误:PGError: Error:时区位移超出范围:…

Some googling later I discovered that this error doesn't occur with ruby 1.9.2 and that (because being on windows) I'd have to install pik to run 1.9.2 alongside 1.9.3. So I installed pik and ruby 1.9.2.

后来我在google上发现ruby 1.9.2没有出现这个错误,而且(因为是在windows上)我必须安装pik才能运行1.9.2和1.9.3。所以我安装了pik和ruby 1.9.2。

However, when I try to install rails on 1.9.2 I get this error:

但是,当我试图在1.9.2安装rails时,我得到了这个错误:

...ERROR: Failed to build gem native extension...

…错误:未能构建gem本机扩展…

After plenty of googling I've ran into the following:

在谷歌上搜索了很多次之后,我遇到了以下问题:

  • Don't bother using windows for ruby/rails development :(
  • 不要为ruby/rails开发使用windows:(
  • Something to do with devkit?
  • 和devkit有什么关系?
  • Or installing a binary kit version of rails?
  • 或者安装二进制工具包版本的rails?
  • Compile it yourself
  • 编译它自己

Any help is much appreciated!

非常感谢您的帮助!

EDIT:

编辑:

Full error stack trace:

完整的错误堆栈跟踪:

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

1 个解决方案

#1


2  

The relevant part of the error message is gcc: Command not found; so the compiler is not available to compile the code locally.

错误消息的相关部分是gcc:没有找到命令;因此编译器无法在本地编译代码。

If you already have gcc installed on your machine somewhere, make sure it is included in the PATH.

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

Check the How to install gcc on windows 7 machine? for guidance on how to install gcc on windows.

查看如何在windows 7机器上安装gcc ?有关如何在windows上安装gcc的指南。

#1


2  

The relevant part of the error message is gcc: Command not found; so the compiler is not available to compile the code locally.

错误消息的相关部分是gcc:没有找到命令;因此编译器无法在本地编译代码。

If you already have gcc installed on your machine somewhere, make sure it is included in the PATH.

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

Check the How to install gcc on windows 7 machine? for guidance on how to install gcc on windows.

查看如何在windows 7机器上安装gcc ?有关如何在windows上安装gcc的指南。