ruby-on-rails – 可以在Ruby 2.4上运行Rails 4.2应用程序吗?

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 可以在Ruby 2.4上运行Rails 4.2应用程序吗?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想在 Ruby 2.4上尝试一个Rails 4.2应用程序.

但是,当我尝试这样做时,我收到关于json gem 1.8.3版无法安装的错误.

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/agrimm/.rbenv/versions/2.4.0-rc1/lib/ruby/gems/2.4.0/gems/json-1.8.3/ext/json/ext/generator
/Users/agrimm/.rbenv/versions/2.4.0-rc1/bin/ruby -r ./siteconf20161223-91367-cql0ne.rb extconf.rb
creating Makefile

current directory: /Users/agrimm/.rbenv/versions/2.4.0-rc1/lib/ruby/gems/2.4.0/gems/json-1.8.3/ext/json/ext/generator
make "DESTDIR=" clean

current directory: /Users/agrimm/.rbenv/versions/2.4.0-rc1/lib/ruby/gems/2.4.0/gems/json-1.8.3/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
generator.c:861:25: error: use of undeclared identifier 'rb_cFixnum'
    } else if (klass == rb_cFixnum) {
                        ^
generator.c:863:25: error: use of undeclared identifier 'rb_cBignum'
    } else if (klass == rb_cBignum) {
                        ^
2 errors generated.
make: *** [generator.o] Error 1

make Failed,exit code 2

Gem files will remain installed in /Users/agrimm/.rbenv/versions/2.4.0-rc1/lib/ruby/gems/2.4.0/gems/json-1.8.3 for inspection.
Results logged to /Users/agrimm/.rbenv/versions/2.4.0-rc1/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-14/2.4.0-static/json-1.8.3/gem_make.out

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

我假设是由于Fixnum和Bignum统一到整数.

如果我添加到Gemfile一个约束,json必须是版本2.0.0,那么它抱怨Rails 4.2需要json〜> 1.7,禁止2.0.0.

我没有运气,除非Rails的维护者决定改变非5.x版本的Rails,否则json宝石的维护者会决定创建一个新的非2.x版本的宝石?

解决方法

现在可以用轨道 4.2.8.rc1(2017年2月11日)
原文链接:/ruby/271963.html

猜你在找的Ruby相关文章