通过RubyGems安装JSON 1.8.1时出错

时间:2015-02-20 18:37:56

标签: ruby-on-rails ruby json

我的操作系统是Windows 7 64x Ultimate。我尝试像这样安装json gem:

gem install json -v '1.8.1'

但我有一个问题:

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 -r ./siteconf20150220-2012-1uff8mn.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/js
on-1.8.1/gem_make.out

如何安装json 1.8.1?

2 个答案:

答案 0 :(得分:1)

这似乎是Rubygems的一个已知错误。看看github上的issue page for this bug结束。

尚未修复,但有望很快修复。目前,似乎大多数人都必须降级到rubygems 2.3.0 才能让它在Windows上运行。那应该可以解决你的问题。

答案 1 :(得分:0)

您必须将红宝石宝石更新到最新版本

现在检查您的红宝石

$Ruby -v

将其更新为ruby版本2.3.7

$rvm list known
$rvm install 2.3.7
$rvm use 2.3.7 --default
$gem install bundler

观看此视频https://www.youtube.com/watch?v=lsNXc3uQ2AA&lc=z22pvls4asawvhi5004t1aokgq0e4p2vb1qpp3w3z252bk0h00410.1528974099408204 让我知道是否有帮助!