开发者社区> 问答> 正文

gem 无法下载json?报错

centos源码安装gitlab,已经安装mysql,在安装gem的时候使用

sudo -u git -H bundle install --deployment --without development test postgres aws



提示错误

An error occurred while installing json (1.8.1), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.1'` succeeds before bundling.



然后执行

gem install json -v '1.8.1'



报错

Fetching: json-1.8.1.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing json:
	ERROR: Failed to build gem native extension.

    current directory: /usr/local/lib/ruby/gems/2.3.0/gems/json-1.8.1/ext/json/ext/generator
/usr/local/bin/ruby -r ./siteconf20160119-1952-glgiso.rb extconf.rb
creating Makefile

current directory: /usr/local/lib/ruby/gems/2.3.0/gems/json-1.8.1/ext/json/ext/generator
make "DESTDIR=" clean

current directory: /usr/local/lib/ruby/gems/2.3.0/gems/json-1.8.1/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
In file included from generator.c:1:
../fbuffer/fbuffer.h:175:47: error: macro "rb_str_new" requires 2 arguments, but only 1 given
In file included from generator.c:1:
../fbuffer/fbuffer.h: In function ‘fbuffer_to_s’:
../fbuffer/fbuffer.h:175: warning: initialization makes integer from pointer without a cast
make: *** [generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/lib/ruby/gems/2.3.0/gems/json-1.8.1 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/json-1.8.1/gem_make.out



请问有人处理过这个问题么!!

展开
收起
爱吃鱼的程序员 2020-06-10 14:53:00 1081 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    嘿嘿,找到办法了!就是

    [root@test48gitlab]#vimGemfile.lock



    在里面找到json'1.8.1',修改成其他高级版本就可以了!

    2020-06-10 14:53:15
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载