看起来Bundler无法找到宝石。也许你没有安装这个应用程序需要的所有宝石

时间:2016-12-21 20:03:31

标签: ruby-on-rails ruby apache amazon-ec2 passenger

我使用乘客宝石在apache中部署了rails应用程序,我收到以下错误。按照链接部署rails应用程序
https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-passenger-and-apache-on-ubuntu-14-04

错误: -

  It looks like Bundler could not find a gem. Maybe you didn't install all the gems that this application needs.  
To install your gems, please run:

    bundle install  


      If that didn't work, then the problem is probably caused by your application being run under a different environment  
than it's supposed to. Please check the following:

        Is this app supposed to be run as the www-data user?
        Is this app being run on the correct Ruby interpreter? Below you will see which Ruby interpreter Phusion Passenger attempted to use.  

追踪: -

        -------- The exception is as follows: -------
        Your bundle is locked to activesupport (4.2.6), but that version could not be found in any of the sources listed in your Gemfile.   
    If you haven't changed sources, that means the author of activesupport (4.2.6) has removed it.   
    You'll need to update your bundle to a different version of activesupport (4.2.6) that hasn't been removed in order to install. (Bundler::GemNotFound)

          /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/definition.rb:179:in `rescue in specs'
          /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/definition.rb:173:in `specs'
          /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/definition.rb:233:in `specs_for'
          /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/definition.rb:222:in `requested_specs'
          /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:118:in `block in definition_method'
          /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:19:in `setup'
          /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler.rb:99:in `setup'
          /var/lib/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/setup.rb:20:in `<top (required)>'
          /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
          /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
          /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:430:in `activate_gem'
          /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:297:in `block in run_load_path_setup_code'
          /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:435:in `running_bundler'
          /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:296:in `run_load_path_setup_code'
          /usr/share/passenger/helper-scripts/rack-preloader.rb:100:in `preload_app'
          /usr/share/passenger/helper-scripts/rack-preloader.rb:156:in `<module:App>'
          /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'

      /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'  

更新

    source 'https://rubygems.org'
    # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
    gem 'rails', '4.2.6'
    # Use sqlite3 as the database for Active Record
    gem 'sqlite3'
    # Use SCSS for stylesheets
    gem 'sass-rails', '~> 5.0'
    # Use Uglifier as compressor for JavaScript assets
    gem 'uglifier', '>= 1.3.0'
    # Use CoffeeScript for .coffee assets and views
    gem 'coffee-rails', '~> 4.1.0'
    # See https://github.com/rails/execjs#readme for more supported runtimes
    # gem 'therubyracer', platforms: :ruby

    # Use jquery as the JavaScript library
    gem 'jquery-rails'
    # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
    gem 'turbolinks'
    # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
    gem 'jbuilder', '~> 2.0'
    # bundle exec rake doc:rails generates the API under doc/api.
    gem 'sdoc', '~> 0.4.0', group: :doc
    gem "unicorn"
    gem "thin"
    gem "passenger"  
    group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'

  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'

2 个答案:

答案 0 :(得分:2)

你必须安装rails 4.2.6 gem

gem install rails -v 4.2.6

sudo gem install rails -v 4.2.6

答案 1 :(得分:0)

教程中似乎缺少一个步骤,运行

gem install bundler

然后你应该可以运行

bundle install