Rails服务器和控制台无法启动:“无法加载此类文件 - zip / zip(LoadError)”

时间:2016-02-25 10:31:17

标签: ruby-on-rails bundler

我的开发服务器已经运行多年了。今天,也许是由于捆绑器版本的一些更新,服务器和控制台在启动时都已经开始失败。

我真的不知道可能出现什么问题。似乎有些宝石已经更新:

diff --git a/Gemfile.lock b/Gemfile.lock
index 2ee3882..a931a88 100644
@@ -33,9 +33,9 @@ GEM
       activerecord (>= 3.0)
     addressable (2.4.0)
     afm (0.2.2)
-    airbrake (5.0.3)
+    airbrake (5.0.5)
       airbrake-ruby (~> 1.0)
-    airbrake-ruby (1.0.3)
+    airbrake-ruby (1.0.4)
     amoeba (3.0.0)
       activerecord (>= 3.2.6)
     arel (3.0.3)
@@ -60,7 +60,7 @@ GEM
       json (>= 1.7)
       mime-types (>= 1.16)
     chronic (0.10.2)
-    coderay (1.1.0)
+    coderay (1.1.1)
     coffee-rails (3.2.2)
       coffee-script (>= 2.2.0)
       railties (~> 3.2.0)
@@ -73,7 +73,7 @@ GEM
       i18n (>= 0.5.0)
       json
     debug_inspector (0.0.2)
-    devise (3.5.5)
+    devise (3.5.6)
       bcrypt (~> 3.0)
       orm_adapter (~> 0.1)
       railties (>= 3.2.6, < 5)
@@ -139,9 +139,9 @@ GEM
       actionpack (>= 3.1)
       less (~> 2.6.0)
     libv8 (3.16.14.13)
-    listen (3.0.5)
+    listen (3.0.6)
       rb-fsevent (>= 0.9.3)
-      rb-inotify (>= 0.9)
+      rb-inotify (>= 0.9.7)
     lumberjack (1.0.10)
     mail (2.4.4)
       i18n (>= 0.4.0)
@@ -155,7 +155,7 @@ GEM
     multiple_table_inheritance (0.2.1)
       activerecord (>= 3.0.0)
       activesupport (>= 3.0.0)
-    nenv (0.2.0)
+    nenv (0.3.0)
     nested_form (0.3.2)
     nokogiri (1.6.7.2)
       mini_portile2 (~> 2.0.0.rc2)
@@ -163,9 +163,9 @@ GEM
       nenv (~> 0.1)
       shellany (~> 0.0)
     orm_adapter (0.5.0)
-    pdf-reader (1.3.3)
+    pdf-reader (1.4.0)
       Ascii85 (~> 1.0.0)
-      afm (~> 0.2.0)
+      afm (~> 0.2.1)
       hashery (~> 2.0)
       ruby-rc4
       ttfunk
@@ -179,7 +179,7 @@ GEM
       method_source (~> 0.8.1)
       slop (~> 3.4)
     rack (1.4.7)
-    rack-cache (1.5.1)
+    rack-cache (1.6.1)
       rack (>= 0.4)
     rack-mini-profiler (0.9.8)
       rack (>= 1.1.3)
@@ -207,7 +207,7 @@ GEM
     raindrops (0.15.0)
     rake (10.5.0)
     rb-fsevent (0.9.7)
-    rb-inotify (0.9.5)
+    rb-inotify (0.9.7)
       ffi (>= 0.5.0)
     rdoc (3.12.2)
       json (~> 1.4)
@@ -230,7 +230,7 @@ GEM
       rspec-core (~> 3.4.0)
       rspec-expectations (~> 3.4.0)
       rspec-mocks (~> 3.4.0)
-    rspec-core (3.4.2)
+    rspec-core (3.4.3)
       rspec-support (~> 3.4.0)
     rspec-expectations (3.4.0)
       diff-lcs (>= 1.2.0, < 2.0)
@@ -238,7 +238,7 @@ GEM
     rspec-mocks (3.4.1)
       diff-lcs (>= 1.2.0, < 2.0)
       rspec-support (~> 3.4.0)
-    rspec-rails (3.4.1)
+    rspec-rails (3.4.2)
       actionpack (>= 3.0, < 4.3)
       activesupport (>= 3.0, < 4.3)
       railties (>= 3.0, < 4.3)
@@ -248,7 +248,7 @@ GEM
       rspec-support (~> 3.4.0)
     rspec-support (3.4.1)
     ruby-rc4 (0.1.5)
-    rubyzip (1.1.7)
+    rubyzip (1.2.0)

服务器和控制台的错误消息:

/home/javier/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in `require': cannot load such file -- zip/zip (LoadError)
    from /home/javier/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from /home/javier/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in `each'
    from /home/javier/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in `block in require'
    from /home/javier/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in `each'
    from /home/javier/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in `require'
    from /home/javier/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/gems/1.9.1/gems/bundler-1.5.3/lib/bundler.rb:131:in `require'
    from /home/javier/Workspace/e-nrg/config/application.rb:7:in `<top (required)>'
    from /home/javier/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/commands.rb:39:in `require'
    from /home/javier/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/commands.rb:39:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

2 个答案:

答案 0 :(得分:2)

Docs

  

Rubyzip界面已经改变了!无需“拉链/拉链”   并删除了类名中的Zip前缀。

     

如果您遇到任何需要旧版本的第三方宝石的问题   rubyzip的版本,您可以使用此解决方法:

     

gem'rubyzip','&gt; = 1.0.0'#将加载新的rubyzip版本   gem'zip-zip'#将加载旧rubyzip API的兼容性。

所以我认为“多年”意味着你一直在使用旧的rubyzip api。所以添加zip-zip宝石,你应该没问题。

答案 1 :(得分:1)

在Gemfile中添加rb-readline并尝试运行rails server。如果不起作用,请执行sudo apt-get install libreadline-dev并重复此过程。