我正在尝试按以下方式在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

最佳答案

RubyGems 2.4.1不会在Windows的Ruby 1.9.3及更早版本中构建 native 扩展。

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

gem update --system 1.8.29

检查gem版本:
gem -v
1.8.29

现在,再次尝试您的命令:
gem install --local json-1.8.1.gem

引用:https://groups.google.com/forum/#!topic/rubyinstaller/k19SeJijpKU/discussion

关于ruby-on-rails - Ruby gem安装问题,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/24950844/

10-14 15:04
查看更多