[版本信息]錯誤安裝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」。其實我是初學者,只是遵循了我的指導原則,所以我在處理問題時不靈活。 –