15

我正在尝试在 Windows 机器上安装 ruby​​,但遇到了问题。当我开始遇到错误时,我已经到了这一点,而且我对 PHP 之外的任何东西都完全陌生,用于 Web 开发。帮助表示赞赏!

编辑我正在按照 wamp 的说明进行操作:

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
4

5 回答 5

30

从上面显示的输出中,我假设以下内容:

  • 已安装 Ruby 2.0.0 x64(64 位)
  • 从 RubyInstaller 页面安装了一些DevKit

现在,正如这里所解释的,对于 64 位 Ruby,您需要 64 位 DevKit。

从输出中的错误:

make: x86_64-w64-mingw32-gcc: Command not found

很明显,您没有安装正确的 DevKit。

Please remove the DevKit installed, download the correct one (as indicated in the link above and in RubyInstaller downloads page) and install again.

You will require to use ruby dk.rb install --force (note the --force option) to override the previous DevKit installation.

As for the the deprecation error, --include-dependencies is no longer required. I recommend you use as installation reference a modern Ruby/Rails guide.

于 2013-05-16T04:37:12.660 回答
5

You can go the RailsInstaller way to install Rails and all dependencies in one go without getting into such problems.

于 2013-05-16T04:43:52.557 回答
5

For me, the problem was that the DevKit binaries did not get added to the PATH. Make sure that (DEVKIT_FOLDER)\mingw\bin is on the path.

于 2015-03-03T21:27:27.390 回答
0

Because I read this answer with hope of fixing my problem, and found it did not help, here's how I resolved it:

--

Your error is:

make: x86_64-w64-mingw32-gcc: Command not found

--

The error means that you don't have access to the gcc/gc++ compiler on your PC.

You should therefore either locate, or download a version of the compiler to your system. I found installing the build tools located here solved the issue.

You just have to download those tools, then add them to the PATH var: set PATH=C:/path/to/your/ming64/location/;%PATH%;

This should build it for you.

A caveat -- whether you have the correct dependencies for a build to take place is another question entirely.

于 2015-03-20T11:01:23.030 回答
0

The exe is in rubydevkit\mingw\bin. Just add that to your path and json will build.

于 2015-10-10T23:29:11.763 回答