无法安装 gem - make 未被识别为内部或外部命令可操作的程序或批处理文件 [英] Cannot install gem - make is not recognized as an internal or external command operable program or batch file

查看:51
本文介绍了无法安装 gem - make 未被识别为内部或外部命令可操作的程序或批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 Windows 7 上安装带有 ruby​​ 1.9.3 的 rspec-rails gem.我收到一些错误,说无法安装某些 json 库.所以,我使用下面的说明来解决它.Source = 'json' 原生 gem 需要安装构建工具

I wanted to install the rspec-rails gem with ruby 1.9.3 on windows 7. I got some errors saying that some json libraries could not be installed. So, I used the instructions below to solve it. Source = The 'json' native gem requires installed build tools

  1. 从 [rubyinstaller.org][3] 下载 [Ruby 1.9.3][2]
  2. 从 [rubyinstaller.org][3] 下载 DevKit 文件
    • 对于 Ruby 1.9.3,请使用 [DevKit-tdm-32-4.5.2-20110712-1620-sfx.exe][4]

回到手头的问题,您应该能够通过运行以下命令来安装 JSON(或以其他方式测试您的 DevKit 是否成功安装),该命令将执行 JSON gem 的安装,然后使用它:

To return to the problem at hand, you should be able to install JSON (or otherwise test that your DevKit successfully installed) by running the following commands which will perform an install of the JSON gem and then use it:

gem install json --platform=ruby
ruby -rubygems -e "require 'json'; puts JSON.load('[42]').inspect"

当我执行上面的第一步时,出现错误 -

When I execute the above first step, I get the error -

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

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

make
'make' is not recognized as an internal or external command,
operable program or batch file.

Gem 文件将保留安装在 C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.1 中以供检查.结果记录到 C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.1/ext/json/ext/generator/gem_make.out

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

我现在正在尝试解决上述错误 -

I am trying to solve the above error now -

'make' 不是内部或外部命令,也不是可运行的程序或批处理文件.使用 make 不被识别为内部或外部命令 - Qt SDK - Windows

如果有人已经知道如何解决这个问题,请帮助我.我一直在努力安装 gems 并且我失败了这么多天.我想知道ruby是不是这么难.

If someone already knows how to fix this, then please help me. I have been struggling to install gems and I am failing for so many days. I am wondering if ruby is so difficult.

DOSKEY 方法失败了!!!

The DOSKEY approach failed !!!

我这样做了 - 安装 Mingw 并安装了它的所有开发人员工具和基础材料.然后在环境变量中添加C:\MinGW\bin,找到mingw32-make.exe.然后,我运行 DOSKEY make=mingw32-make 和 ruby​​ 命令.我得到了同样的错误.我猜测 ruby​​ 代码是从隐藏的 cmd 窗口中生成的,这就是该命令不起作用的原因.DOSKEY 仅在您运行它的 cmd 窗口中有效.

I did this - Install Mingw and installed all its developer tools and base stuff. Then added C:\MinGW\bin to environment variables to find mingw32-make.exe. Then, I ran the DOSKEY make=mingw32-make followed by the ruby command. I got the same error. I am guessing that the ruby code is spawning off a hidden cmd window and thats why the command is not working. DOSKEY is valid only in the cmd window in which you run it.

下一步 - 不太好,但是,我将 mingw32-make.exe 更改为 make.exe 并查看.

Next step - Not so nice, but, I'll change mingw32-make.exe to make.exe and see.

再次失败,出现新错误 -

Failed again with a new error -

暂时增强 PATH 以包含 DevKit... 构建原生扩展名.这可能需要一段时间......错误:安装json时出错:错误:无法构建 gem 本机扩展.

Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... ERROR: Error installing json: ERROR: Failed to build gem native extension.

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

make生成generator-i386-mingw32.def编译generator.c在包含在 generator.c:1:0: ../fbuffer/fbuffer.h:5:18: 致命的文件错误:ruby.h:没有这样的文件或目录#includeruby.h"^ 编译终止.Makefile:204: 目标 'generator.o' 的配方失败 make: *** [generator.o] 错误 1

make generating generator-i386-mingw32.def compiling generator.c In file included from generator.c:1:0: ../fbuffer/fbuffer.h:5:18: fatal error: ruby.h: No such file or directory #include "ruby.h" ^ compilation terminated. Makefile:204: recipe for target 'generator.o' failed make: *** [generator.o] Error 1

Gem 文件将保持安装在C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.1 用于检查.结果登录C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.1/ext/json/ext/generator/gem_make.out

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

我现在该怎么办?

推荐答案

我曾尝试在 windows 系统上安装 ruby​​ on rails,虽然有安装 ruby​​ 本身和 rails 的一键安装程序,但许多 gems 依赖于基于 posix 的操作系统要编译,因此几乎不可能在 Windows 上进行实际工作.

I have tried to setup ruby on rails on a windows system, although there are one click installers that install ruby itself and rails, many of the gems rely on a posix based operating system to be compiled, thus making it near impossible to do actual work on windows.

我的建议是给自己一个 linux 系统,也许是你的系统上的 unbuntu 和双启动,或者获得一个虚拟的 pc 软件,像这样 一个,或任何其他选项,然后尝试从那里安装 ruby​​.

My advise would be to get yourself a linux system, perhaps unbuntu on your system and dual boot, or get a virtual pc software, like this one, or any of the other options, and try installing ruby from there.

这篇关于无法安装 gem - make 未被识别为内部或外部命令可操作的程序或批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆