Tôi muốn thử một ứng dụng Rails 4.2 trên Ruby 2.4.Có thể chạy ứng dụng Rails 4.2 trên Ruby 2.4 không?
Tuy nhiên, khi tôi thử làm điều đó, tôi gặp lỗi về phiên bản đá quý json 1.8.3 không cài đặt được.
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.
mà tôi giả định là do việc hợp nhất Fixnum và Bignum thành Số nguyên.
Nếu tôi thêm vào Gemfile một ràng buộc mà json phải là phiên bản 2.0.0, thì nó phàn nàn rằng Rails 4.2 yêu cầu json ~> 1.7, cấm 2.0.0.
Tôi không may mắn trừ khi người duy trì Rails quyết định thay đổi phiên bản Rx không 5.x, hoặc người bảo trì đá quý json quyết định tạo phiên bản không phải là phiên bản 2.x mới của họ đá quý?
Kể từ khi đăng câu trả lời này , ruby 2.4 phiên bản tương thích của json ('1.8.5') và arel (' 6.0.4') đã được phát hành. Điều chính chúng tôi đang chờ đợi bây giờ là phát hành bản phát hành mới 4.2.x'. –
.. và bây giờ đường ray 4.2.8 đã được phát hành, điều đó là đủ để các ứng dụng khởi động trên ruby 2.4. Có khả năng là một vài phụ thuộc cấp độ thứ hai và thứ ba sẽ in không dùng nữa, nhưng hy vọng chúng không gây tử vong –