簡體   English   中英

如何讓 rails 與 jruby 和 rvm 一起工作 - ruby 版本不斷翻轉

[英]How to get rails to work with jruby and rvm - ruby version keeps flipping

遷移 Rails 應用程序的 gem 文件

"ruby '2.5.1'"

(運行良好)到

"ruby '2.5.1', :engine => 'jruby', :engine_version => '9.1.17.0'" 

我已經使用以下方法修改了環境:

rvm use jruby-9.1.17.0

然而,當我運行 bundle install 我得到

Your Ruby version is 2.3.3, but your Gemfile specified 2.5.1

其他信息:

    ~$ rvm current 
    jruby-9.1.17.0
    ~$ rvm list
    => jruby-9.1.17.0 [ x86_64 ]
   jruby-9.2.6.0 [ x86_64 ]
   ruby-1.9.2-p318 [ x86_64 ]
   ruby-1.9.2-p320 [ x86_64 ]
   ruby-1.9.2-p330 [ x86_64 ]
   ruby-1.9.3-p374 [ x86_64 ]
   ruby-1.9.3-p547 [ x86_64 ]
   ruby-2.0.0-p481 [ x86_64 ]
   ruby-2.0.0-p576 [ x86_64 ]
   ruby-2.1.1 [ x86_64 ]
   ruby-2.1.3 [ x86_64 ]
   ruby-2.3.1 [ x86_64 ]
   ruby-2.4.0 [ x86_64 ]
 * ruby-2.5.1 [ x86_64 ]

我看不到 2.3.3 版本是從哪里來的? 有任何想法嗎? 我正在使用 MacOS 和 RVM

所說的絕對值得關注:

Your Ruby version is 2.3.3, but your Gemfile specified 2.5.1

如果你做一個rvm jruby-9.1.17.0 do ruby --version你會得到像這樣的 smt:

jruby 9.1.17.0 (2.3.3) 2018-04-20 d8b1ff9 Java HotSpot(TM) 64-Bit Server VM 25.171-b11 on 1.8.0_171-b11 +jit [linux-x86_64]

(2.3.3)部分表示它的 Ruby 2.3 所以我建議你使用 JRuby 9.2:

rvm install jruby-9.2.8.0

將為您提供與2.5(.3)兼容的 Ruby 運行時,相應地更新Gemfile

"ruby '2.5.3', :engine => 'jruby', :engine_version => '9.2.8.0'" 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM