2015-09-25 41 views
1

我正在使用JRuby,因爲它對於Windows上的SRS Ruby on Rails更好。無法訪問Windows中的Rails控制檯 - LoadError

我的解決方案是在cmd.exe或Powershell(不是gitbash)中使用jirb

我已經試過:

$ rails console 
Loading development environment (Rails 4.2.4) 
Switch to inspect mode. 
LoadError: load error: rails/commands -- java.lang.UnsatisfiedLinkError: The operation completed successfully. 

    require at org/jruby/RubyKernel.java:939 
    <top> at bin/rails:4 

和:

$ bundle exec rails console 
uri:classloader:/jruby/kernel/kernel.rb:17: warning: unsupported exec option: close_others 
Loading development environment (Rails 4.2.4) 
Switch to inspect mode. 
LoadError: load error: rails/commands -- java.lang.UnsatisfiedLinkError: The operation completed successfully. 

    require at org/jruby/RubyKernel.java:939 
    <top> at bin/rails:4 

和:

$ jruby.exe -S bundle exec rails console 
uri:classloader:/jruby/kernel/kernel.rb:17: warning: unsupported exec option: close_others 
Loading development environment (Rails 4.2.4) 
Switch to inspect mode. 
LoadError: load error: rails/commands -- java.lang.UnsatisfiedLinkError: The operation completed successfully. 

    require at org/jruby/RubyKernel.java:939 
    <top> at bin/rails:4 

我試圖解決 「Load error when running rails console」,但在重新啓動電腦有沒有影響。 bin/spring沒有提及GEM_HOME。我重新安裝了Rails和Spring。

這是因爲JRuby?

我覺得jruby -S rails console需要C擴展。我發現了另一種使用JRuby自己的jirc訪問控制檯的方法。我開始:

$ jirb 
Switch to inspect mode. 

然後編輯〜/ .irbrc包括

IRB.conf[:PROMPT_MODE] = :SIMPLE 

它生產:

$ jirb 
Switch to inspect mode. 
>> 

然後立即退出。這樣做:

$ jirb puts 'hello' 
Switch to inspect mode. 
Errno::ENOENT: No such file or directory - puts 
    initialize at org/jruby/RubyFile.java:342 
     open at org/jruby/RubyIO.java:1124 
     open at G:/jruby-9.0.1.0/lib/ruby/stdlib/irb/magic-file.rb:7 
    initialize at G:/jruby-9.0.1.0/lib/ruby/stdlib/irb/input-method.rb:100 
    initialize at G:/jruby-9.0.1.0/lib/ruby/stdlib/irb/context.rb:84 
    initialize at G:/jruby-9.0.1.0/lib/ruby/stdlib/irb.rb:426 
     start at G:/jruby-9.0.1.0/lib/ruby/stdlib/irb.rb:381 
     <top> at G:/jruby-9.0.1.0/bin/jirb:13 

由於我的控制檯仍然沒有工作,沒有什麼關於jirc使用C擴展,這個問題是不是重複那一個。

+0

OSX或Linux系統? –

+0

Windows使用jruby 9.0.1.0 –

+0

[JRuby無法正常工作的Rails應用程序的可能的重複](http://stackoverflow.com/questions/21051052/rails-app-with-jruby-not-working) –

回答

0

TL; DR在命令中使用jirb提示符執行Ruby代碼。

我從未解決讓rails console工作。這可能與我的ruby安裝是jRuby的一部分有關。

但是,irbjirb允許我使用命令提示符或Powershell在命令行上執行Ruby代碼片段。 GitBash不起作用,說Switch to inspect mode.然後>>,然後退出。

0

是的,我會嘗試安裝JRuby來解決這個

http://jruby.org/getting-started

然後做bundle從項目的根

+0

Unistalled jruby,已刪除的jruby目錄,已安裝的jruby,已安裝的捆綁包,已運行捆綁包,已安裝所有gems。同樣的問題。 –