[版本信息]错误安装JSON 1.8.3红宝石2.4
红宝石2.4.0p0(2016年12月24日修订版57164)[x86_64的Linux的] /GEM 2.0.3/ 视窗10
我跑bundle install
它告诉我跑gem install json -v '1.8.3'
我这样做,并得到了失败打造宝石原生扩展错误。
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
/home/ec2-user/.rvm/rubies/ruby-2.4.0/bin/ruby extconf.rb
creating Makefile
make
compiling generator.c
generator.c: In function ‘generate_json’:
generator.c:861:25: error: ‘rb_cFixnum’ undeclared (first use in this function)
} else if (klass == rb_cFixnum) {
^
generator.c:861:25: note: each undeclared identifier is reported only once for each function it appears in
generator.c:863:25: error: ‘rb_cBignum’ undeclared (first use in this function)
} else if (klass == rb_cBignum) {
^
generator.c: At top level:
cc1: warning: unrecognized command line option "-Wno-self-assign" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-constant-logical-operand" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-parentheses-equality" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-tautological-compare" [enabled by default]
make: *** [generator.o] Error 1
Gem files will remain installed in /home/ec2-user/.rvm/gems/ruby-2.4.0/gems/json-1.8.3 for inspection.
Results logged to /home/ec2-user/.rvm/gems/ruby-2.4.0/gems/json-1.8.3/ext/json/ext/generator/gem_make.out
我检查了几个文件。 我安装的devkit和JSON 1.8.5,但我的项目一直是“安装JSON 1.8.3” 我怎样才能解决这个问题?消息
/home/ec2-user/.rvm/gems/ruby-2.4.0/gems/json-1.8.3
包含:
../
./
data/
diagrams/
ext/
java/
lib/
tests/
tools/
install.rb*
.gitignore
.travis.yml
CHANGES
COPYING
COPYING-json-jruby
GPL
Gemfile
README-json-jruby.markdown
README.rdoc
Rakefile
/home/ec2-user/.rvm/gems/ruby-2.4.0/gems/json-1.8.3/ext/json/ext/generator/gem_make.out
包含:
user/.rvm/gems/ruby-2.4.0/gems/json-1.8.3/ext/json/ext/generator/gem_make.out
/home/ec2-user/.rvm/rubies/ruby-2.4.0/bin/ruby extconf.rb
creating Makefile
make
compiling generator.c
generator.c: In function ‘generate_json’:
generator.c:861:25: error: ‘rb_cFixnum’ undeclared (first use in this function)
} else if (klass == rb_cFixnum) {
^
generator.c:861:25: note: each undeclared identifier is reported only once for each function it appears in
generator.c:863:25: error: ‘rb_cBignum’ undeclared (first use in this function)
} else if (klass == rb_cBignum) {
^
generator.c: At top level:
cc1: warning: unrecognized command line option "-Wno-self-assign" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-constant-logical-operand" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-parentheses-equality" [enabled by default]
cc1: warning: unrecognized command line option "-Wno-tautological-compare" [enabled by default]
make: *** [generator.o] Error 1
第一个问题是为什么你需要JSON宝石? Ruby具有内置的JSON支持。其次,为什么要使用旧版本? Ruby 2.4.0改变了许多可能需要使用最新版本的gem的内部。如果你对这个特定版本的依赖性很强,你可能需要使用Ruby 2.3.x或者它可以编译的东西,直到你可以删除这个限制。 – tadman
@tadman我需要JSON版本1.8.3,因为putty需要我。如果我运行'bundle install',putty命令我设置JSON 1.8.3。我安装了其他版本(2.0.3和2.0。2),但它一直说“安装JSON 1.8.3”。其实我是初学者,只是遵循了我的指导原则,所以我在处理问题时不灵活。 –