Ruby gem安装问题

时间:2014-07-25 08:02:31

标签: ruby-on-rails ruby gem rubygems

我正在尝试按如下方式在Windows上安装json,但它无法正常工作。请帮我解决相同问题。

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

    C:/Ruby193/bin/ruby.exe -r ./siteconf20140725-4216-11o740j.rb extconf.rb
creating Makefile

make  clean
Makefile:165: *** target pattern contains no `%'.  Stop.

make
Makefile:165: *** target pattern contains no `%'.  Stop.

make failed, exit code 2

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/extensions/x86-mingw32/1.9.1/json-1.8.1/gem_make.out

1 个答案:

答案 0 :(得分:9)

RubyGems 2.4.1不会在Windows 1.9及更早版本的Windows上构建本机扩展。

您需要将RubyGems降级到1.8.29。 为此,请运行以下命令:

gem update --system 1.8.29

检查宝石版本:

gem -v
1.8.29

现在再次尝试你的命令:

gem install --local json-1.8.1.gem

参考:https://groups.google.com/forum/#!topic/rubyinstaller/k19SeJijpKU/discussion