无法在Windows中安装JSONGEM?

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (2)
  • 关注 (0)
  • 查看 (99)

我试图在Windows上安装JSON GEM。我安装了devkit。我得到以下错误。有什么建议吗?

d:\source\my_project>gem install json -v '1.6.3'
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:/Ruby200/bin/ruby.exe extconf.rb
creating Makefile

make
generating parser-i386-mingw32.def
compiling parser.c
In file included from parser.rl:1:0:
../fbuffer/fbuffer.h:129:13: warning: 'fbuffer_append_long' defined but not used [-Wunused-function]
../fbuffer/fbuffer.h:136:17: warning: 'fbuffer_dup' defined but not used [-Wunused-function]
../fbuffer/fbuffer.h:149:14: warning: 'fbuffer_to_s' defined but not used [-Wunused-function]
../fbuffer/fbuffer.h:90:13: warning: 'fbuffer_append_str' defined but not used [-Wunused-function]
linking shared-object json/ext/parser.so

make install
/usr/bin/install -c -m 0755 parser.so C:/Ruby200/lib/ruby/gems/2.0.0/gems/json-1.6.3/ext/json/ext/json/ext
/usr/bin/install: cannot create regular file `C:/Ruby200/lib/ruby/gems/2.0.0/gems/json-1.6.3/ext/json/ext/json/ext': No such file or directory
make: *** [install-so] Error 1


Gem files will remain installed in C:/Ruby200/lib/ruby/gems/2.0.0/gems/json-1.6.3 for inspection.
Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/json-1.6.3/ext/json/ext/parser/gem_make.out
提问于
用户回答回答于
用户回答回答于

我也有这个问题,通过这样做解决了这个问题:

使用Ruby版本-2.2.2

GEM版本-2.3.0(如果您有最新的gem版本安装,可以使用命令降级-gem update --system 2.3.0)

解压缩后,将路径添加到devkit&mingw\bin到PATH变量,导航到devkit目录并运行以下命令

ruby dk.rb init

ruby dk.rb install

最后,重新启动命令提示符&尝试

gem install json

这对我有用。

扫码关注云+社区

领取腾讯云代金券