简体   繁体   中英

Rails server and console fails to start : “cannot load such file — zip/zip (LoadError)”

My development server has worked fine for years. Today, perhaps due to some update in bundler version, both server and console have started to fail when launched.

I really have not a clue of what might be wrong. It seems that some gems have been updated:

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)

Error message for both server and console:

/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>'

Docs

The Rubyzip interface has changed!!! No need to do require "zip/zip" and Zip prefix in class names removed.

If you have issues with any third-party gems that require an old version of rubyzip, you can use this workaround:

gem 'rubyzip', '>= 1.0.0' # will load new rubyzip version gem 'zip-zip' # will load compatibility for old rubyzip API.

So I assume "for years" means you'd have been using the old rubyzip api. So add the zip-zip gem and you should be fine.

Add rb-readline in your Gemfile and try to run rails server. If it doesn't work do sudo apt-get install libreadline-dev and repeat the process.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM