【发布时间】:2017-05-07 08:43:50
【问题描述】:
我使用乘客 gem 在 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'
【问题讨论】:
-
试试
bundle update -
你是运行
bundle还是bundle install? -
是的,但同样的问题
-
您也可以发布您的 gem 文件吗?特别是您指定rails 或activesupport 的地方。你有没有用
gem install代替bundle install?您尝试安装的 gem 似乎需要不同版本的active_support,该版本已锁定在 4.2.6 版
标签: ruby-on-rails ruby apache amazon-ec2 passenger