-->

无法安装在Windows JSON宝石(Can't install json gem in

2019-08-31 10:05发布

我试图在Windows上安装JSON宝石。 我安装的devkit。 我得到下面的下面的错误。 有什么建议? 这个问题

JSON宝石将不会安装(Windows)中

建议安装的devkit,并尝试使用json_pure。 我做了两个。 问题是,我的包安装尝试安装JSON和将不会进行安装JSON直到。 这是一个捆绑安装Rails项目BTW。

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

Answer 1:

我有这个问题太,这样做解决了这个:

使用Ruby版本- 2.2.2

宝石版本- 2.3.0(如果你有最新的宝石版本安装就可以使用命令降级- gem update --system 2.3.0

请注意,即使你是64位Windows系统,下载并从中提取32位的devkit( 的devkit-mingw64-32-4.7.2-20130224-1151-sfx.exe) 在这里

一旦提取,添加路径的devkit和MinGW的\ bin添加到您的路径变量导航到的devkit目录和下面的命令运行

ruby dk.rb init

ruby dk.rb install

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

gem install json

这为我工作。 希望这可以帮助。



Answer 2:

我不得不使用版本1.7.7。 我不知道为什么,但它似乎是与你的Ruby版本兼容。 这样做:创业板安装JSON -v '1.7.7'



Answer 3:

在我的情况,我下载红宝石(32位)的错误的版本,但使用64位Windows I =>出现的错误。 你需要的第一件事是检查是否开发套件正常工作。

gem install json --platform=ruby

如果它不能正常工作,你应该遵循波纹管教程,使其工作。 https://github.com/oneclick/rubyinstaller/wiki/Development-Kit

而在此之后,您可以normaly安装JSON宝石。 我认为。 祝好运。



文章来源: Can't install json gem in Windows